Add this chunk to app.js
http://code2run.blogspot.ca/2016/01/rest-api-example-by-express-js.html
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();
});
you can replace * with specific domain when your application in turn to production mode
e.g. enable cros request for domain - mastermoin.com
res.header("Access-Control-Allow-Origin", "mastermoin.com");
* is only recommended for development purpose.
No comments:
Post a Comment