我想使用 GMap API 计算 2 个坐标之间的距离。 无论如何,我正在寻找从 URL 捕获返回数据
https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&key={{myKey}}
我试图搜索,但没有任何目的。 请帮助我或给我关键字。非常感谢!
最佳答案
你可以使用 super 棒的request包
来自它的文档:
Request 被设计为最简单的 http 调用方式。它支持 HTTPS 并默认遵循重定向。
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
})
希望有帮助!
关于node.js - 如何使用 SailsJS 调用 Google API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32986179/