Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 express.js 路由中设置会话时
app.get('/', function(req, res() { req.session.foo = 'bar'; });
我无法在其他路线中访问它(未定义)。这可能吗?有没有我必须考虑的特殊配置?
谢谢!
我实际上通过设置这样的会话来解决它:
global.session.email = JSON.parse(chunk).email;
通过这个,会话变量是全局的!
解决了!