Answers for "res.locals in express"

1

res.locals in express

req.locals, res.locals or even your own defined key res.userData can be used. However, when using a view engine with Express, you can set intermediate data on res.locals in your middleware, and that data will be available in your view (see this post). It is common practice to set intermediate data inside of middleware on req.locals to avoid overwriting view data in res.locals, though this is not officially documented.
Posted by: Guest on June-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language