reids作为session报Error: Can't set headers after they are sent.
配置如下:
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var redisStore = require('connect-redis')(session);
app.use(session({
//redis
store: new redisStore(),
secret: 'somesecrettoken',
cookie: { maxAge: 60 * 1000 }
}));
路由控制
router.get('/', function(req, res, next) {
var name = req.body.name;
var pass = req.body.pass;
var id = req.session.id;
//res.render('index', { title: 'Express',name:'my',id:id});
res.end(id);
});
才学node.js没有多长时间,汗。。这个问题怎么解决呢 是版本不对还是什么原因了