我试图在我的某个组件中呈现Yelp API中的一些数据,并且我收到以下错误:
Fetch API cannot load https://api.yelp.com/v3/businesses/search?location=New%20York. Response for preflight has invalid HTTP status code 500
之前我遇到过CORS错误,但我刚刚为Chrome安装了一个插件(临时解决方案?)。
这是呈现数据的功能
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,
};
我对所发生的事情有一个模糊的概念,问题在于尝试在我的内部服务器中获取数据,但我不确定如何修复它。有什么想法吗?