const axios = require("axios") const getPlacePhoto = require("./getPlacePhoto.js") module.exports = async (q) => { const res = await axios.get( `https://maps.googleapis.com/maps/api/place/findplacefromtext/json?inputtype=textquery&fields=photos,formatted_address,name,rating,opening_hours,geometry&input=${q}&key=${process.env.GOOGLE_CLOUD_APIS}`) console.log(res.data) // Photo url is not returned since it overuses Google Place API /* for (let candidate of res.data.candidates) { for (let photo of candidate.photos) { photo.url = await getPlacePhoto(photo.photo_reference) } } */ return res.data }