var RedisStore = require('connect-redis')(express);
var redis_ip='192.168.238.135',
redis_port ='6379' ;
app.use(express.session({
secret: 'wefew',
store: new RedisStore({
host: redis_ip,
port: redis_port
}),
}));
app.get('/redisses',function(req,res){
req.session.user = 'lizhengfu';
res.send(req.session.user);
})
app.get('/checkses',function(req,res){
console.log(req.session.user);
})
代码扔在这里,有不懂就问吧,因为东西都揉在一起,不方便把所有代码贴上。