How to use Node.js connect MemoryStore in production?

Sometimes, we want to use Node.js connect MemoryStore in production.

In this article, we’ll look at how to use Node.js connect MemoryStore in production.

How to use Node.js connect MemoryStore in production?

To use Node.js connect MemoryStore in production, we can use the cookie-session package.

To install it, we run

npm install cookie-session

Then we use it in our Connect app by writing

app.use(require('cookie-session')({
  //  config
}));

to require the cookie-session module and call it with some options store in the object.

And then we call app.use with the returned middleware to let us use cookie-session as the session store.

Conclusion

To use Node.js connect MemoryStore in production, we can use the cookie-session package.