Follow middleware pattern

This commit is contained in:
Daniel García Aubert
2018-03-07 14:48:21 +01:00
parent 292dad130d
commit eb3414f07f

View File

@@ -87,7 +87,7 @@ LayergroupController.prototype.register = function(app) {
`${basePath}/:token/:layer/:z/:x/:y.(:format)`,
cors(),
userMiddleware,
validateLayerRouteMiddleware,
validateLayerRoute(),
this.prepareContext,
this.getMapStoreMapConfigProvider(this.mapStore, this.userLimitsApi),
this.layer(this.tileBackend),
@@ -244,12 +244,14 @@ LayergroupController.prototype.register = function(app) {
);
};
function validateLayerRouteMiddleware(req, res, next) {
if (req.params.token === 'static') {
return next('route');
}
function validateLayerRoute () {
return function validateLayerRouteMiddleware(req, res, next) {
if (req.params.token === 'static') {
return next('route');
}
next();
next();
};
}
LayergroupController.prototype.analysisNodeStatus = function (analysisStatusBackend) {