16 lines
347 B
JavaScript
16 lines
347 B
JavaScript
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() {
|
|
return cors({origin: true});
|
|
};
|
|
|
|
|