I’m trying to add an argument to a function passed along as an argument in an express js route.
This is an expressjs route:
app.get('path', someFunc,
function(req, res, next) {
res.render('layout');
});
The function someFunc right there takes the arguments req, res, next.
I want to add an additional argument to it. If I use apply or call it seems to replace all the existing arguments.
I want to be able to do:
someFunction (req, res, next, custom) {}
How can I do this? Thanks.
I am not sure that this is the best way but you could do something like this :