Express.js not responding when using session

Here is my application:

var express = require('express'), app = express.createServer(), RedisStore = require('connect-redis')(express); app.configure (function(){ app.use (express.logger({ format: ":method :url" })); app.use (express.bodyParser()); app.use (express.cookieParser()); app.use (express.session({ store: new RedisStore, secret: "totally random string" })); }); app.configure ('development', function () { console.log ("Development mode."); }); app.configure ('production', function () { console.log ("Production mode."); }); app.get ('/', function (req, res) { res.contentType("text/html"); res.send("hello", 200); res.end(); }) console.log ("Listening to *:"+8006); app.listen (8006); 

It freezes in the browser when I use localhost: 8006 /

Any idea what is wrong? I probably miss 1 small detail.
It works when the line app.use (express.session... commented out

thanks

+4
source share
1 answer

Remove res.end() and it will stop freezing and display the page.

 var express = require('express'), app = express.createServer(); app.configure (function(){ app.use (express.logger({ format: ":method :url" })); app.use (express.bodyParser()); app.use (express.cookieParser()); }); app.configure ('development', function () { console.log ("Development mode."); }); app.configure ('production', function () { console.log ("Production mode."); }); app.get ('/', function (req, res) { res.contentType("text/html"); res.send("hello"); }) console.log ("Listening to *:"+8006); app.listen (8006); 
+3
source

All Articles