I'm developing an app on my local pc. THe frontend should be built with spinejs and the backend-api with node.js.
Spine is running on port 9294 and node.js is running on port 3000.
in Spine I've added to my model the following:
@url: http:localhost:3000/posts
and in my express server
app.get('/posts', function(req, res){
console.log(giving ALL the posts);
res.header(Access-Control-Allow-Origin, *)
res.json(posts);
});
But I'm always getting the following erro in chrome:
XMLHttpRequest cannot load http://localhost:3000/posts. Origin http://localhost:9294 is not allowed by Access-Control-Allow-Origin.
What must I do that I can access my api properly? I though adding the header in the responses does fix the problem.