alb3rt-core
Version:
12 lines (10 loc) • 441 B
JavaScript
module.exports = function (request, response, next) {
response.header('Access-Control-Allow-Origin', '*');
response.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
response.header('Access-Control-Allow-Headers', 'Content-Type,Authorization,x-system-access-key,withCredentials');
if (request.method.toLowerCase() === 'options') {
response.sendStatus(200);
} else {
next();
}
};