mikedklein
09/24/2017, 4:02 PMhttps.get
method to make the request but it just isn't working
const https = require('https');
module.exports = function (event) {
const GEOCODE_API = '<https://maps.googleapis.com/maps/api/geocode/json?>';
const API_KEY = 'key=<MYGOOGLEAPIKEY>';
const STREET = event.data.street;
const CITY = event.data.city;
const STATE = event.data.state;
const ZIP = event.data.zip;
const ADDRESS_KEY = 'address=' + STREET + '%20' + CITY + '%2C%20' + STATE + '%20' + ZIP;
const URL = GEOCODE_API + API_KEY + '&' + ADDRESS_KEY;
https.get(URL, (res) => {
console.log('statusCode:', res.statusCode);
console.log('headers:', res.headers);
res.on('data', (d) => {
console.log(d);
});
}).on('error', (e) => {
console.error(e);
});
}
nilan
09/24/2017, 4:33 PMnilan
09/24/2017, 4:34 PMfetch
instead (isomorphic-fetch
)nilan
09/24/2017, 4:34 PM