Merge pull request #406 from braydonf/v0.3.0-cors

Add CORS support
This commit is contained in:
Patrick Nagurny 2015-10-14 13:14:26 -04:00
commit 4606e6e953

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));