Middleware naming convention

This commit is contained in:
Daniel García Aubert 2018-03-01 18:46:04 +01:00
parent da18506e41
commit 314508bcd8

View File

@ -1,11 +1,14 @@
module.exports = function cors(extraHeaders) { module.exports = function cors(extraHeaders) {
return function(req, res, next) { return function corsMiddleware (req, res, next) {
var baseHeaders = "X-Requested-With, X-Prototype-Version, X-CSRF-Token"; var baseHeaders = "X-Requested-With, X-Prototype-Version, X-CSRF-Token";
if(extraHeaders) { if(extraHeaders) {
baseHeaders += ", " + extraHeaders; baseHeaders += ", " + extraHeaders;
} }
res.set("Access-Control-Allow-Origin", "*"); res.set("Access-Control-Allow-Origin", "*");
res.set("Access-Control-Allow-Headers", baseHeaders); res.set("Access-Control-Allow-Headers", baseHeaders);
next(); next();
}; };
}; };