【发布时间】:2022-01-08 22:00:37
【问题描述】:
我在登录时设置了req.session 变量,如下所示:
req.session.loggedin = true
req.session.firstname = loginDetails.firstName;
我想要做的是将此信息传递给所有路线(我有将近 60 条,并且不想遍历所有路线并手动添加这些),而且我拥有的每条路线都调用前端使用这个:
res.render('page.ejs', {data: rows}), so I would ideally want it to pass it to the front-end pages so I can access them there too. Not sure if this is possible, but worth a shot! thx 4 the help in advance!
【问题讨论】:
-
这能回答你的问题吗? How to get the session value in ejs
标签: javascript node.js express ejs