I am just starting to learn how to use cookies with node and express and I would like some help with getting this to work. I tried to follow the expressjs/session tutorial o
To get session data
first , You have to initialize express-session with
app.use(session({ resave: true ,secret: '123456' , saveUninitialized: true}));
then When you want to put something in the session
req.session.firstName = 'Aniruddha';
req.session.lastName = 'Chakraborty';
Then you can check without errors
console.log('req.session: '+req.session.firstName);
Note: This is express-sessions work!