res.locals forgotten things and make jshint happy

This commit is contained in:
Simon Martín
2017-09-29 14:38:28 +02:00
parent 482feabce2
commit c22a35489d
4 changed files with 12 additions and 4 deletions

View File

@@ -177,7 +177,13 @@ LayergroupController.prototype.dataview = function(req, res, next) {
var mapConfigProvider = new MapStoreMapConfigProvider(
self.mapStore, req.context.user, self.userLimitsApi, res.locals
);
self.dataviewBackend.getDataview(mapConfigProvider, req.context.user, req.params.dataviewName, res.locals, this);
self.dataviewBackend.getDataview(
mapConfigProvider,
req.context.user,
req.params.dataviewName,
res.locals,
this
);
},
function finish(err, dataview, stats) {
req.profiler.add(stats || {});

View File

@@ -1,5 +1,3 @@
const _ = require('underscore');
module.exports = function authorizeMiddleware (authApi) {
return function (req, res, next) {
req.profiler.done('req2params.setup');

View File

@@ -1,4 +1,4 @@
const locals = require('./locals')
const locals = require('./locals');
const cleanUpQueryParams = require('./clean-up-query-params');
const layergroupToken = require('./layergroup-token');
const authorize = require('./authorize');

View File

@@ -1,7 +1,11 @@
const _ = require('underscore');
module.exports = function layergroupTokenMiddleware(req, res, next) {
// FIXME: Temporary hack to share data between middlewares. Express overrides req.params to
// parse url params to an object and it's performed after matching path and controller.
res.locals = {};
_.extend(res.locals, req.params);
next();
}