const fetch = require('node-fetch')
const GOOGLE_PLACES_API_KEY = 'your-key';
module.exports = function (event) {
const { id } = event.data
return fetch(fetchGooglePlace(id))
.then(res => res.json())
.then(payload => {
console.log(payload)
return {
data: {
payload
}
}
})
}
function fetchGooglePlace(id) {
return `https://maps.googleapis.com/maps/api/place/details/json?placeid=${id}&key=${GOOGLE_PLACES_API_KEY}`
}