Skip to content

Instantly share code, notes, and snippets.

@justsml
Created August 7, 2015 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justsml/5e896b0ad9d323744cd7 to your computer and use it in GitHub Desktop.
Save justsml/5e896b0ad9d323744cd7 to your computer and use it in GitHub Desktop.
Simple async remote service wrapper. ToDo: Needs to validate & parse the remote JSON response
var API_KEY = '';// <<-- '<__YOUR_KEY__HERE__>';
module.exports = function _geocode(address, callback) {
require('request')
.get('https://maps.googleapis.com/maps/api/geocode/json?region=us&address=' + encodeURIComponent(address) + '&key=' + encodeURIComponent(API_KEY))
.on('response', function(response) {
callback(null, response);
}).on('error', function(err) {
callback(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment