7

I'm learning ExpressJS, and I want to make a Register-Login system.

I'm reading about express-session and it seems kind of easy to use but I wonder,

  • by default, where does it store session for each user ?
  • And when do those session get deleted ?

Can U guys give me some blog post about this ? Thank U

Kostas Minaidis
  • 2,819
  • 1
  • 14
  • 22
Neoflies
  • 243
  • 3
  • 6

1 Answers1

10

If you don't supply express-session with a storage mechanism, then it just uses a lightweight memory store. Thus, it is not persisted across server restarts.

From the doc:

store

The session store instance, defaults to a new MemoryStore instance.

The MemoryStore comes with these warnings:

Warning The default server-side session storage, MemoryStore, is purposely not designed for a production environment. It will leak memory under most conditions, does not scale past a single process, and is meant for debugging and developing.

For a list of stores, see compatible session stores.

Community
  • 1
  • 1
jfriend00
  • 637,040
  • 88
  • 896
  • 906