9

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
  • 4,681
  • 3
  • 17
  • 25
Neoflies
  • 263
  • 1
  • 3
  • 7

1 Answers1

14

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
  • 683,504
  • 96
  • 985
  • 979