Created
September 24, 2018 23:45
-
-
Save dlbnco/335faca3cd7e7843b65514f3a2f5139b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment