How do sessions work in Express.js with Node.js?

前端 未结 4 694
渐次进展
渐次进展 2020-11-28 00:52

Using Express.js, sessions are dead simple. I\'m curious how they actually work though.

Does it store some cookie on the client? If so, where can I find that cookie?

4条回答
  •  广开言路
    2020-11-28 01:43

    I'm curious how they actually work though.

    Try to look at this answer and wiki stuff.

    Does it store some cookie on the client?

    Yes, it's usually a cookie with assigned session ID, which should be signed with a secret in order to prevent forgery.

    If so, where can I find that cookie? If required, how do I decode it?

    You shouldn't mess with a session cookie on the client side. If you want to work with sessions on the server side you should check out related express.js and connect docs.

提交回复
热议问题