Accessing the session object after a POST


I’m using express.js with the session middleware. This is my code:

var express = require('express'),
app = express.createServer();

app.configure(function () {
.use(express.session({ secret: 'blabla' }));
});'/login', function (request, response) {
console.log(request.session); // Prints `undefined`

How can I access the session object?

Problem courtesy of: Randomblue


Your exact code with app.listen() appended works for me. Make sure you're using the latest express. I tried on express v2.5.1 and node v0.6.5.

Solution courtesy of: fent

View additional discussion.