How to end a session in ExpressJS

前端 未结 9 883
小鲜肉
小鲜肉 2020-12-12 15:48

I feel like this has to be buried somewhere in the documentation, but I can\'t find it.

How do you close or end or kill (whatever) a session in ExpressJS?

9条回答
  •  长情又很酷
    2020-12-12 16:09

    As mentioned in several places, I'm also not able to get the req.session.destroy() function to work correctly.

    This is my work around .. seems to do the trick, and still allows req.flash to be used

    req.session = {};
    

    If you delete or set req.session = null; , seems then you can't use req.flash

提交回复
热议问题