SyntaxFix
Write A Post
Hire A Developer
Questions
Attach your variable to the req object, not res.
req
res
Instead of
res.somevariable = variable1;
Have:
req.somevariable = variable1;
As others have pointed out, res.locals is the recommended way of passing data through middleware.
res.locals