Reputation: 9835
Here is my app:
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 hangs in the browser when I use localhost:8006/
Any idea whats wrong? I am probably missing 1 little detail.
It works when the app.use (express.session...
line is commented out
Thanks
Upvotes: 4
Views: 2826
Reputation: 41607
Remove the res.end()
and it stops the hanging and renders 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);
Upvotes: 3