nodejs 中的session中间件 和 cookieSession中间件有什么区别?
黄舟2017-04-17 11:08:00
session
The middleware doesn’t know which of the following you are referring to:
1) https://npmjs.org/package/session
2) https://npmjs.org/package/sessionss
cookieSession I think you are referring to:
3) https://npmjs.org/package/connect-cookie-session
To see if there are any differences, just look at the documentation or source code provided by npm. You can do more analysis by yourself.
1) The source code is 404 on github, so I’m not sure. I don’t seem to have used it, so I don’t want to install it to see the code
2) It is a comprehensive session manager that provides physical files, MySQL, direct storage in process memory, and cookies for session storage
3) The purpose is the same as 2, but simpler. Only client-side Cookie is provided as a storage method
Session actually saves some data that needs to be used immediately during the user session. The data needs to be stored somewhere. These middleware encapsulates the logic of real data storage and provides corresponding storage, update, retrieval, Delete the operation interface.