diff --git a/app.js b/app.js index e80d81ccf3c9c4373b98615636979b1db23ede1e..c111385b9c567c167dfe4a20f0e3e370c65913e5 100644 --- a/app.js +++ b/app.js @@ -14,10 +14,11 @@ app.use(bodyParser.json()); //enable CORS 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", "*"); - res.header("Access-Control-Allow-Methods", "GET"); + if(req.method=="OPTIONS"){ res.sendStatus(204);