【发布时间】:2018-09-18 01:36:07
【问题描述】:
我正在开发一个移动应用程序,可以通过使用 Aylien Sentiment Analysis API 来分析某人的想法,我正在使用 Ionic 2 Angular 4,我设法为 Ionic 实现了 Aylien Sentiment Analysis API,但我遇到了这个问题,Cross原始资源共享 (CORS) 使我无法访问 Aylien 情绪分析,我已经搜索过它并且我开始了解 CORS 的想法,但唯一的是我不知道如何禁用 CORS 或解决这个问题使用 CORS。
这是我用来访问或请求 Aylien 的 API 文本分析的代码
var AYLIENTextAPI = require('aylien_textapi');
var textapi = new AYLIENTextAPI({
application_id: "My ID",
application_key: "My Key"
});
textapi.sentiment({'text': 'John is a very good football player!'}, function(error, response) {
if (error === null) {
console.log(response);
}
else {
console.log(error);
}
});
这是给我的错误
我已经处理了一段时间了,我决定在这里寻求帮助,提前感谢您的回复。
【问题讨论】:
标签: javascript node.js angular ionic-framework