I know that global vars are a bad practice in javascript and in programming overall, but i want to make my user session available throughout my express.js app, avoiding having to pass the session parameter all over, from my controllers to my models.
How can I best do this?
Thanks!
I ended up solving this like so:
Then add it to the middleware:
if you really want to do this, add the request or session to the global-object of node though i would also not recommend this...