请求模块使这变得非常容易。从npm将请求安装到您的软件包中,然后您可以发出一个get请求。
var request = require("request")var url = "http://developer.cumtd.com/api/v2.2/json/GetStop?" + "key=d99803c970a04223998cabd90a741633" + "&stop_id=it"request({ url: url, json: true}, function (error, response, body) { if (!error && response.statusCode === 200) { console.log(body) // Print the json response }})您可以在npm上找到要求的文档:https
://npmjs.org/package/request



