开发者

Querying JSON API with node.js

How should querying a JSON API be done best in node.js? Is there a module that will simplify this?

I am trying to get the City location from http://maps.googleapis.com/map开发者_C百科s/api/geocode/json?latlng=40.714224,-73.961452

I would use jQuery to query the API in client-side because it vastly simplifies things. Is there something similar for node.js?


The request module makes http-request very easy. Just place a GET request to your URL and JSON.parse() the response. You might want to use encodeURIComponent() for your query parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜