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.
typecho2017-06-24 09:45:18
Introducing the cookie-parser
package.
const app = express();
...
const cookieParser = require('cookie-parser');
app.use(cookieParser());
...
Then you should be able to use req.cookies
in the routing to get the cookie object