The thing that I got is that when saveUninitialized is false then it's not storing session in store. So then how to create session manually if it's not in req.session?
@yolapop saveUninitialized means if you have not added anything to the "session" there is no session created (no cookie is sent to the user). ie: A user goes to your blog to read something they are just there to read something and leave they don't need a session saveUninitialized = false will not make a session for them. If they login and your app runs req.session.username = <their username> their session is created and a cookie is sent to them.
@gabeio thanks for the explanation, but when I used saveUninitialized = false, I couldn't set req.session.username = <their username> because req.session was undefined. I'm confused about how to create session manually
Wait, sorry I just remembered, it's resolved. req.session was not undefined.
Most helpful comment
@yolapop
saveUninitializedmeans if you have not added anything to the "session" there is no session created (no cookie is sent to the user). ie: A user goes to your blog to read something they are just there to read something and leave they don't need a sessionsaveUninitialized = falsewill not make a session for them. If they login and your app runsreq.session.username = <their username>their session is created and a cookie is sent to them.