I am trying to integrate Redis sessions into my authentication system written in Node.js.
I have been able to successfully set up Redis server, connect-redis>
That should be all there is to it. You access the session in your route handlers via req.session
. The sessions are created, saved, and destroyed automatically.
If you need to manually create a new session for a user, call req.session.regenerate()
.
If you need to save it manually, you can call req.session.save()
.
If you need to destroy it manually, you can call req.session.destroy()
.
See the Connect documentation for the full list of methods and properties.