Created
August 7, 2015 17:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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