The user enters the domain name. If he has logged in before, he will go directly to the homepage. Otherwise, he will jump to the login interface because after logging in, I save the username in the cookie. Now I want to use cookies to determine if the user is logged in or not.
Introducing the
cookie-parser
package.Then you should be able to use
req.cookies
in the routing to get the cookie object