This rendr - sessions has a middleware module ...
module.exports = function incrementCounter() {
return function incrementCounter(req, res, next) {
var app = req.rendrApp
, count = app.get('session').count || 0;
req.updateSession('count', count + 1);
next();
};
};
Can you not achieve the same with the following?
module.exports = function incrementCounter(req, res, next) {
var app = req.rendrAp
, count = app.get('session').count || 0;
req.updateSession('count', count + 1);
next();
};
My question is: why are you exporting a function that returns a function with arguments? Is there any benefit to the first that I don't know about?
source
share