My angular project ist running on port 8100 and the Express 4 server uses port 8080.
How to make cross-domain access possible?
I added the following lines to my server.js (Express 4):
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
customersFactory.js
var path = 'http://localhost:8080';
factory.getCustomers = function() {
return $http.get(path + '/customers');
};
factory.getCustomers = function(customersId) {
return $http.get(path + '/customer/' + customersId);
};
The following error occurs:
GET http://localhost:8080/customer/undefined 404 (Not Found)