diff --git a/app.js b/app.js index b8dfbd664264439075f4961cbb0ffed7f1f07a12..e80d81ccf3c9c4373b98615636979b1db23ede1e 100644 --- a/app.js +++ b/app.js @@ -11,6 +11,24 @@ var app = express(); app.use(logger('dev')); 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-Methods", "GET"); + + res.sendStatus(204); + + }else{ + + next(); + + } + +}); + app.use('/icarus/str', storage); app.use('/icarus/svc', services);