Guys am quite new to nodejs a few days in I have setup a Mongodb, built some apis, implemented registration, login and authentication n its all good now I implemented an authentication Middleware so that users have to be logged in access those route and I have implemented express-session to help me store a few data like email and SessionID, I used uuid to generate unique sessionJD and in the server.js where I added the app.use(session(secret, resave:true, uninitialized:true, genId: function { return uuid()}, console.log(sessionID) // Output "I get a sessionID");Upon successfully login I set req.session.user = req. body.emailBut in my auth Middleware when I try to access req.session I find it's undefined and also if I console.log(sessionID) in the auth middleware which is in an Auth.js file its also undefined. What could be wrong....... #nodejs
Submitted July 16, 2019 at 03:19PM by joeycrack1
No comments:
Post a Comment