I am currently migrating my server to use nest.js.
When I use the @Session()
decorator it gives me undefined.
I do import it from @nestjs/common, this is not the issue.
@Get('foo')
async find(@Session() sess) {
console.log(sess); // sess == undefined
}
While, with express the session is defined
router.get('/foo/', function(req, res){
console.log(req.session); // req.session is defined
Thanks for your help!
The session middleware is not applied by default, you have to do it manually:
app.use(session({ secret: 'nest is awesome' }))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With