From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Session management in Express

Session management in Express

From the course: Databases for Node.js Developers

Start my 1-month free trial

Session management in Express

- A very common use case for Redis is session storage. I assume that you basically know what user sessions are in a web application context. You might not have Node.jsd but in our shopping application, we do already utilize sessions to some degree. For instance, here in my user admin route, when we scroll down a little bit, you see that I'm here writing into request session dot messages, and I'm using this to implement user notification. So these are the notifications that you see in the front end and I'm using sessions, because then the notification survives the redirect that we see in line 37. Also, if we scroll further down, we have this impersonate route. In there, I'm writing the user ID that was selected into the session. Right now, we are doing nothing with it, but we will add some logic to this later. Let's see how the session management is right now implemented for that. I open app.js, and there you see in line…

Contents