Sessions in Node JS

前端 未结 10 802
北海茫月
北海茫月 2021-01-07 23:46

How can I maintain my SESSIONS in Node JS ? E.g I want to store UserID in SESSION using Node Js. How can I do that in Node JS ? And can I use that Node JS SESSION in PHP too

10条回答
  •  生来不讨喜
    2021-01-08 00:17

    You can handle the session in two-way.

    1. Using express-session
    2. Using JWT web token and handle own session(Token Based Session handling).

    I think token based session handling is more important rather than using express-session. You will get a problem when you scale your server and also a problem some single device login situation.

    For Checking I have Token Based Session Hanling node js folder structure.You can check. It may be helpful

提交回复
热议问题