I am using express and pug, there are some values that I would like to pass to pug on every request, for example: req.session
and req.path
. Passing these values to the render()
method every time just seems too redundant.
So instead of doing something like this:
app.get('/', (req, res) => {
res.render('home', {session: req.session})
})
app.get('/profile', (req, res) => {
res.render('profile', {session: req.session})
})
The more routes that get added, the more of those items I need to manage. Is there a global way that I can set them once other than app.locals
so they are unique per request?