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.
精彩评论