这是我的应用程序: 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.bod
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);
当我使用localhost时它挂在浏览器中:8006 /
有什么想法错了吗?我可能错过了一点细节.
它适用于app.use(express.session …行被注释掉的时候
谢谢
删除res.end()并停止挂起并呈现页面.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);