search

Home  >  Q&A  >  body text

node.js - nodejs 中的session中间件 和 cookieSession中间件有什么区别?

nodejs 中的session中间件 和 cookieSession中间件有什么区别?

天蓬老师天蓬老师2784 days ago617

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-17 11:08:00

    sessionThe 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.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 11:08:00

    http://blog.fens.me/nodejs-connect/

    reply
    0
  • Cancelreply