so I basically want to use sessions to store the users name and check to see if the user logged in or not. If not, the page will redirect to the login page.
If you're doing app.use(app.router) before the lines that set up the cookie and session handling, try moving it to after them. That fixed the same problem for me.