我目前正在使用node.js编程一个rest api,它计算两个地理坐标之间的直线。为了计算结果,我需要以下4个参数:start_lon
start_lat
end_lon
end_lat
所以,如果我的电话是这样的:http://hostname/beeline/{start_lon}/{start_lat}/{end_lon}/{end_lat}
或者更像这样:http://hostname/beeline?start_lon={start_lon}&start_lat={start_lat}&end_lon={end_lon}&end_lat={end_lat}
最佳答案
正如你所说,你有4个参数来计算直线。然后,您将对beeline资源使用http查询参数。然后:
http://hostname/beeline?start_lon={start_lon}&start_lat={start_lat}&end_lon={end_lon}&end_lat={end_lat}
这样,参数可以改变访问直线资源的方式。