I am trying to run a Angular 2 project with npm start on my machine and access the backend on another server. When I call a post or get I always getting the \'Access-Contro
Set this up before you API route and after your app use
app.use(express.static(publicPath)); // Set the path for express to use
// Add headers
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Authorization');
next();
});