When running node js in production mode, this warning is logged :
Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
Doing a brief research, i found that i should use other alternatives for session storage by passing express-session-mongo or express-session-redis .
My questions :
Thank You !
I resolved it by using the cookie-session
library, i simply flowed the tutorial.
cookie-session on github
I would highly suggest backing your session's with a database. I would use Redis, CouchDB/Cloudant, memcached, or Mongo.
The reason express is giving that error is the in memory database is only available on the current node you are running and if you scale your application the session data will not be available on other nodes.
Check out http://passportjs.org/ , there are some modules to help you store the session data into an external resource.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.