gpt4 book ai didi

javascript - 实现复杂 REST 调用的最佳实践是什么?

转载 作者:可可西里 更新时间:2023-11-01 16:29:27 24 4
gpt4 key购买 nike

我目前正在使用 Node.js 编写 REST API,计算两个地理坐标之间的直线。为了计算结果,我需要以下 4 个参数:

  • start_lon
  • 起始纬度
  • 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 个参数 来计算直线。然后您将对直线资源使用 HTTP 查询参数。然后:

http://hostname/beeline?start_lon={start_lon}&start_lat={start_lat}&end_lon={end_lon}&end_lat={end_lat}

这样,参数可变访问直线资源的方式。

关于javascript - 实现复杂 REST 调用的最佳实践是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55665680/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com