这是我的Express应用程序配置的样子:
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.cookieSession({secret: conf.sessionSecret}));
app.use(express.session({secret: conf.sessionSecret}));
app.use(app.router);
每当我这样做时:
app.get('/logout', function (req, res)
{
res.clearCookie('userId');
req.session.destroy();
res.redirect('/login');
});
我明白了:
TypeError: Object #<Object> has no method 'destroy'.
取出app.use(express.cookieSession());解决它。这是为什么?