use anonymous function instead of arrow function in middleware export to don't bind this

This commit is contained in:
Eneko Lakasta 2018-02-26 15:57:42 +01:00
parent 521b441da5
commit 8867cdbc02

View File

@ -1,10 +1,12 @@
'use strict';
module.exports = () => function apikeyTokenMiddleware(req, res, next) {
const apikeyCredentials = getApikeyCredentialsFromRequest(req);
res.locals.api_key = apikeyCredentials.token;
res.locals.apikeyUsername = apikeyCredentials.username;
return next();
module.exports = function() {
return function apikeyTokenMiddleware(req, res, next) {
const apikeyCredentials = getApikeyCredentialsFromRequest(req);
res.locals.api_key = apikeyCredentials.token;
res.locals.apikeyUsername = apikeyCredentials.username;
return next();
};
};
//--------------------------------------------------------------------------------