In this rendr - sessions example, there's an express 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 thing 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 would you export a function which returns a function with arguments? Is there some sort of benefit to the former that I am unaware of?