Added cruising api endpoint support

This commit is contained in:
2018-03-08 14:42:01 -05:00
parent 04f3d42c01
commit b653fd2eaf
4 changed files with 524 additions and 2 deletions

View File

@@ -1,8 +1,17 @@
var NodeGeocoder = require('node-geocoder');
const NodeGeocoder = require('node-geocoder');
function addressToString (address) {
var string = '';
string = address.address1 ? address.street1 + ',' : '';
string = string + (address.locality ? ' ' + address.locality + ',' : '');
string = string + (address.region ? ' ' + address.region : '');
string = string + (address.postal ? ' ' + address.postal : '');
string = string + (address.country ? ' ' + address.country : '');
return string;
}
var options = {
provider: 'google',
// Optional depending on the providers
httpAdapter: 'https', // Default
apiKey: 'AIzaSyCvpBGztvxtRUNigOW9f0GXVRWlukJZsps', // for Mapquest, OpenCage, Google Premier
@@ -12,6 +21,8 @@ var options = {
var geocoder = NodeGeocoder(options);
exports.addressToString = addressToString;
exports.geocoder = geocoder;