I am a beginner in NodeJS. I was working on a simple session-based user authorization to get a taste and it is working perfectly fine as there are plenty of examples around the internet which are easy to understand. I used express-session and the following code:
app.use(session({
key: 'userid',
secret: 'hojoborolo',
resave: false,
saveUninitialized: false,
cookie: {
expires: 600000
}
}));
created a simple session which then I was able to access using req.session
object.
I went to express-session documentation to get more information on the session data. It clearly said there "Session data is not saved in the cookie itself, just the session ID. Session data is stored server-side. The default server-side session storage is MemoryStore."
Like PHP, where simple PHPSESSID
session data is stored in a file under the default temporary directory /tmp
in server-side, where and how MemoryStore
stores the data in server-side and utilizes it? How MemoryStore
works basically?
P.S.: Coming from a PHP background