Friday, 28 April 2017

How to access a session variable in another controller

I have a controller named login.js. Here, i am setting a session.and redirecting to another controller

request.session.user = "Hello";
response.redirect('/home');

In home.js, i am trying to access this session.

if(request.session.user){
///Do some stuff
}

But it shows

Cannot read property 'user' of undefined



via Jaowat Raihan

No comments:

Post a Comment