var express = require('express');
var app = express();
var RedisStore = require('connect-redis')(express);
var session = require('redis-session')({
debug: true,
ttl: 90000000,
connection: {port: '7170', host: '127.0.0.1'}
});
app.configure(function(){
app.use(express.bodyParser());
app.set('views',__dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));
app.use(express.session({ secret: 'p!550ff', store: new RedisStore }));
app.use(express.cookieParser());
app.use(app.router);
});
使用这种配置,每当我调用 时req.session
,nodemon 都会告诉我它是未定义的。express.cookieParser()
并且express.session
声明得很好,我猜。有什么解决办法...?