Commit 47f4feea authored by andreagerino's avatar andreagerino

Enabling CORS

parent 9a46f8c7
...@@ -14,10 +14,11 @@ app.use(bodyParser.json()); ...@@ -14,10 +14,11 @@ app.use(bodyParser.json());
//enable CORS //enable CORS
app.use(function(req, res, next) { app.use(function(req, res, next) {
if(req.method=="OPTIONS"){ res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
res.header("Access-Control-Allow-Origin", "*"); if(req.method=="OPTIONS"){
res.header("Access-Control-Allow-Methods", "GET");
res.sendStatus(204); res.sendStatus(204);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment