Home > Article > Web Front-end > Share the usage methods of connect middleware session and cookie_node.js
Connect is a node middleware framework. For details, please refer to the official website http://www.senchalabs.org/connect/
Configure in app.js (must be placed before app.use(routes);)
Then use
in the controllerOther methods
When the session is set, we see that there is an extra sid in the cookie, which is to record the session ID
Print req.cookies and req.session objects
You can see that the session talks to the client by saving a connect.sid, but the session is stored in memory
2. Cookie, official document: (http://www.senchalabs.org/connect/cookieParser.html This document fooled me for a whole day), it goes without saying that the following example was tried by me, because There is no usage method in the document
Settings
Delete