#google-maps-api/geocode ##module.exports(req, [onComplete]) ⏏ This wraps the Google Maps Geocoder nicely.
The first parameter you pass in an object which represents your request to the Google Maps Geocoder. For more info visit:
https://developers.google.com/maps/documentation/javascript/reference#GeocoderRequest
require( 'google-maps-api' )( 'your api key here' );
require( 'google-maps-api/geocode' )( {
address: 'Springfield'
})
.then( function( result ) {
console.log( result );
});
- req
google.maps.GeocoderRequest
- For more info on this visit https://developers.google.com/maps/documentation/javascript/reference#GeocoderRequest - [onComplete]
function
- If you prefer not to use promises you can pass in a callback instead. The callback should be in the form offunction( err, data ) {}
Returns: Promise
- This promise will return the result same as the onComplete