Reputation: 271934
So, I did a basic setup:
app.use(express.session({secret:'abc'}));
I did not install redis or any database. By default, how does Node.js handle sessions? Where do they store it?
Upvotes: 1
Views: 1109
Reputation: 2854
here's how you do sessions
// how you setup session
var MemoryStore = require('express').session.MemoryStore;
app.use(express.cookieParser());
app.use(express.session({ secret: "keyboard cat", store: new MemoryStore({ reapInterval: 60000 * 10 })}));
//to store sessions
app.post('/',function(req,res){
req.session.user = "myname";
});
Upvotes: 0
Reputation: 359876
By default the session middleware uses the memory store bundled with Connect, however many implementations exist.
http://expressjs.com/guide.html#session-support
The memory store in Connect: http://senchalabs.github.com/connect/middleware-session-memory.html
So, it's just an in-memory data store (I'm guessing something like a mapping from session ID to {}
).
Upvotes: 1