I try to run my Angular 2 app and it's backend app (node.js) both on the localhost and get an error in browser's console:
There are no errors in the backend app:
I used this code in the backend app to avoid CORS error:
app.use(function * (next) {
this.response.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
this.response.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
this.response.set('Access-Control-Allow-Origin', '*');
yield * next;
});
It seems to me the problem is related to the frontend app (zone.js may be?)
How can I solve this problem?
via Zurab-D


No comments:
Post a Comment