Middleware naming convention
This commit is contained in:
parent
da18506e41
commit
314508bcd8
@ -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();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user