const axios = require("axios") const getPlacePhoto = require("./getPlacePhoto.js") const fields = "photos,place_id,name,rating,geometry" // Parameters for Google Place API module.exports = async (q) => { const res = await axios.get( `https://maps.googleapis.com/maps/api/place/findplacefromtext/json?inputtype=textquery&fields=${fields}&input=${q}&key=${process.env.GOOGLE_CLOUD_APIS}`) // Photo url is not returned by default 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 }