I’m using express.js and i make my own authentication and i need to send an auth variable to every view using res.render(‘view’)
.
I know about res.render(‘view’,variable)
,but i need to send this variable whin every views is rendering new or old in other words i need this variable to be sent with every view render function without sending it as a parameter in res.render(‘view’,parameter)
Asked
Active
Viewed 117 times
0

Ali Salah
- 1
- 1
- 1
-
1Does this answer your question? [Pass variable into view automatically using middleware](https://stackoverflow.com/questions/36170692/pass-variable-into-view-automatically-using-middleware) – Petr Hejda Mar 29 '21 at 18:40
-
not working cause res.locals also need to be declared with every res.render, I want to make the variable sent automatically with all res.render – Ali Salah Mar 29 '21 at 21:38