When attempting to make an API call using the yelp-fusion
, I noticed that the logged result is showing as undefined. It seems like this issue might be related to promises or async functions. It's important for me to maintain this within a function since I plan on exporting it to other files.
const searchRequest = {
term:'cafe',
location: 'san francisco, ca'
};
const client = yelp.client(apiKey);
function businessSearch(search){
client.search(search).then(response => {
return response
}).catch(e => {
console.log(e);
});
}
console.log(businessSearch(searchRequest))