I'm trying to make a script in Node.JS when entering the address and it tells you the products in the place you are. But I get [Error: Invalid latitude & longitude]
I do that with geocoding but every time I run the app with the same or different address I get that. Here is the code
var Uber = require('node-uber');
var geocoderProvider = 'google';
var uber = new Uber({
client_id: 'KEY',
client_secret: ' key',
server_token: 'key',
redirect_uri: 'uri',
name: 'Uber product list'
});
var httpAdapter = 'http';
var geocoder = require('node-geocoder')(geocoderProvider, httpAdapter);
geocoder.geocode('Address', function(err, res) {
console.log(res);
var latitude = res[0]["latitude"]
var longitude = res[0]["longitude"]
console.log(latitude);
console.log(longitude);
uber.products.getAllForLocation(latitude, longitude, function (err, res) {
if (err) console.error(err);
else console.log(res);
});
});