Follow middleware pattern
This commit is contained in:
parent
2c762813ba
commit
bd93e7dc7e
@ -9,7 +9,7 @@ module.exports = function prepareContextMiddleware(authApi, pgConnection) {
|
||||
return [
|
||||
locals(),
|
||||
cleanUpQueryParams(),
|
||||
layergroupToken,
|
||||
layergroupToken(),
|
||||
credentials(),
|
||||
authorize(authApi),
|
||||
dbConnSetup(pgConnection)
|
||||
|
@ -1,6 +1,7 @@
|
||||
var LayergroupToken = require('../../models/layergroup-token');
|
||||
|
||||
module.exports = function layergroupTokenMiddleware(req, res, next) {
|
||||
module.exports = function layergroupToken () {
|
||||
return function layergroupTokenMiddleware(req, res, next) {
|
||||
if (!res.locals.token) {
|
||||
return next();
|
||||
}
|
||||
@ -30,3 +31,4 @@ module.exports = function layergroupTokenMiddleware(req, res, next) {
|
||||
|
||||
return next();
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user