Add CORS support

This commit is contained in:
Braydon Fuller 2015-10-14 12:52:25 -04:00
parent de6a44d14e
commit efdb2487e4

View File

@ -49,6 +49,13 @@ InsightAPI.prototype.start = function(callback) {
};
InsightAPI.prototype.setupRoutes = function(app) {
//Enable CORS
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();
});
//Block routes
var blocks = new BlockController(this.node);
app.get('/blocks', blocks.list.bind(blocks));