What is the difference between 'session' and 'cookieSession' middleware in Connect/Express?

前端 未结 2 1061
误落风尘
误落风尘 2021-01-30 10:32

There are two session-related middlewares bundled with Connect/Express. What is the difference? How do I choose?

I\'m assuming that session middleware is the same as coo

2条回答
  •  不要未来只要你来
    2021-01-30 11:02

    The session middleware implements generic session functionality with in-memory storage by default. It allows you to specify other storage formats, though.

    The cookieSession middleware, on the other hand, implements cookie-backed storage (that is, the entire session is serialized to the cookie, rather than just a session key. It should really only be used when session data is going to stay relatively small.

提交回复
热议问题