我的Range2应用程序运行在8100端口和API项目上,该项目使用节点构建,在不同的端口3003上运行。API项目不是rest项目。
当我试图从Rest客户机或Postman调用API之一时,我将得到响应。
即使尝试从节点调用API,它也可以正常工作。
当从角2项目进行API调用时,它显示了404错误。
角2码-
getApplications() {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('cache-control', 'no-cache');
headers.append('Access-Control-Allow-Origin', '*');
return this.http.post('http://localhost:3003/applications/list', {}, {})
.map(res => res.json());
}
NodeJS工作请求-
var request = require("request");
var options = {
method: 'POST',
url: 'http://localhost:3003/application/list',
headers:
{
'cache-control': 'no-cache',
'content-type': 'application/json'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
邮递员请求-
发布于 2017-03-31 14:30:36
我猜你做错了:
浏览器:http://localhost:3003/application/list
角度:http://localhost:3003/applications/list
https://stackoverflow.com/questions/43143045
复制相似问题