2016-11-09 12:12:59 +00:00
|
|
|
var cors = require('cors');
|
|
|
|
|
|
|
|
var whitelist = ['http://localhost:8080'];
|
|
|
|
var corsOptions = {
|
|
|
|
origin: function(origin, callback){
|
|
|
|
var originIsWhitelisted = whitelist.indexOf(origin) !== -1;
|
|
|
|
callback(originIsWhitelisted ? null : 'Bad Request', originIsWhitelisted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = function() {
|
2016-11-09 13:09:12 +00:00
|
|
|
return cors({origin: true});
|
2016-11-09 12:12:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|