From the course: Databases for Node.js Developers

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Managing user sessions with Redis

Managing user sessions with Redis - Node.js Tutorial

From the course: Databases for Node.js Developers

Managing user sessions with Redis

- [Narrator] In our current setup, we are using fastifySecureSession to manage client-side encrypted sessions. All this happens here in plugins, session.js. And if we look at it, you see that we are dealing here with the current users. So when we are logging in, also all the messages stuff is happening here. And we are using also this session file here to then edit to reply locals to make it available to the whole site. But you see we are relying on sessions already. Right now, we are encrypting the session data at the client level. This means that it's stored at the client and the client then sends it with each request and there, we unpack it. This works but it also makes the cookies larger. It's a little bit of a performance hog and also, it's not the best practice to do it like that. Usually, you rely on server-side sessions and just store the session ID in the cookie. Very often, Redis is used for that and we will now change our session management system to use Redis under the…

Contents