Nodejs Clustering and expressjs sessions

前端 未结 1 2047
心在旅途
心在旅途 2021-01-01 18:41

I\'m trying to build nodejs application which will take advantage of multicore machines ( a.k.a. clustering ) and I got a question about sessions. My code looks like this:

相关标签:
1条回答
  • 2021-01-01 19:23

    You're correct that the in memory session store in Connect/Express is unsuitable for supporting more than one instance. The solution is to implement a session store with a backing database. My recommendation is connect-redis, and example code is at Session Undefined - Using Connect-Redis / ExpressJS / Node

    But there are dozens of options.

    0 讨论(0)
提交回复
热议问题