The session middleware for Express provides several configurable options.
resave: \'Forces the session to be saved back to the session store, even i
Basically, a session is saved in the store only when it is modified; if you add, delete or edit a session cookie (eg: req.session.test = 'some value'
). If you want all the sessions to be saved in store, even if they don't have any modifications go with saveUninitialized: true
.
Now, re-saving also happens only when session variables/cookies changes. If you want to save then always go ahead with resave: true
I thought I would start off with a basic answer, my bit of understanding so far, and improve it together. Important question been 'dead' for too long.
From this I understand the difference is:
(Unmodified 'state' is different to uninitialized state)
resave: For any request made
"Forces session to be saved even when unmodified"
saveUninitialized: Is about the state of the session, if its still in the uninitialized state.
"Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified."