I'm trying to render some data from the Yelp API in one of my components and I'm getting the following error:
Fetch API cannot load https://api.yelp.com/v3/businesses/search?location=New%20York. Response for preflight has invalid HTTP status code 500
I had a CORS error before that but I just installed a plugin for Chrome (temporary solution?).
This is the function for to render data
const yelp = require('yelp-fusion');
const clientId = "MY ID";
const clientSecret = "MY KEY";
const token = "MY TOKEN";
const client = yelp.client(token);
let businessSearch = (inputLocation) => {
client.search({
location: inputLocation
}).then(response => {
console.log(response.jsonBody.businesses[0]);
}).catch(e => {
console.log(e);
});
}
module.exports = {
businessSearch,
};
I have a vague idea of what's going on, the problem lies in trying to fetch data in my internal server but i'm not sure how to fix it. Any ideas?