> ## Content Index
> Fetch the complete content index at: https://helpmonks.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to access sessions in Jade template
- URL: https://helpmonks.com/blog/how-to-access-sessions-in-jade-template/
- Published: 2013-11-25T00:00:00.000Z
- Updated: 2026-04-03T01:58:59.000Z
- Description: Accessing sessions in your Jade template is not straight forward, as in “it just works”. In order to do so, you have to use the Middleware. In short put the
- Author: Nitai
- Tags: email marketing

Accessing sessions in your Jade template is not straight forward, as in “it just works”. In order to do so, you have to use the Middleware. In short put the following in your app.js/server.js:

\[code\]app.use(function(req,res,next){  
res.locals.session = req.session;  
next();  
});  
\[/code\]

Note: Make sure you insert the above **before** app.use(app.router);

Once done you are now able to access your sessions with #{session.myvar} in your Jade templates.

Enjoy 🙂