Prateek Sharma
Prateek Sharma

Reputation: 127

difference between client-sessions vs express-sessions in nodejs

There is a similar question but it has not answered the how client and express sessions are different to each other.

I believe client sessions store cookies on client side browsers and express session stores cookies in database like mongo stores.

Upvotes: 4

Views: 2447

Answers (2)

Dean Gallis
Dean Gallis

Reputation: 1

The cookie-session middleware takes the cookie data and assigns it to the session property (all the necessary data is in the cookie), whereas express-session middleware stores a reference to a session inside the cookie, which often points to some remote data store outside your application.

Upvotes: 0

Shekhar Tyagi
Shekhar Tyagi

Reputation: 1674

Basically, express-session is more abstract, it supports different session stores (like files, DB, cache and whatnot).

And client-session is a simple / lightweight cookie-based (cookie is the only storage engine supported: all the session info is stored on the client, in a cookie) session implementation.

Upvotes: 5

Related Questions