Commit 9a46f8c7 authored by andreagerino's avatar andreagerino

Enabling CORS

parent d382cdf5
...@@ -11,6 +11,24 @@ var app = express(); ...@@ -11,6 +11,24 @@ var app = express();
app.use(logger('dev')); app.use(logger('dev'));
app.use(bodyParser.json()); 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/str', storage);
app.use('/icarus/svc', services); app.use('/icarus/svc', services);
......
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