Session Nov 3, 2017 Contents 引入所需模块保存到本地 用于在用户登录后保持用户的回话 引入所需模块12345678910var session = require('express-session');var MongoStore = require('connect-mongo')(session);app.use(session({ secret: 'foo', store: new MongoStore({ url: dburl, collection: 'session' })})); 保存到本地123456app.use(function(req, res, next) { var _user = req.session.user app.locals.user = _user next()})