Here is my function:
exports.dashboard = function(req, res ,next) {
console.log(req.session);
var userForCheck = req.session.user_name;
console.log(user);
}
in my console screen it's printed out req.session like this :
Sess {
cookie:
{ path: '/',
_expires: 2018-11-16T03:18:31.896Z,
originalMaxAge: 59999,
httpOnly: true }
user: { user_name: 'given001', password: '123' } }
but the user variable is
undefinded
how can i store user_name in userForCheck variable without undefined?
Actually it should be like,
var userForCheck = req.session.user.user_name;
Hope this helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.