Question

My understanding is that, in apps using express on top of node, the session object can be accessed through req.session, which can have any number of key/value pairs set on it.

What's the advantage of using this method over storing key/value pairs on the global sessionStorage object in the DOM?

Was it helpful?

Solution

There are several advantages:

  • express.session stays on your server, so you can store things there that won't be accessible to the client
  • express sessions don't have storage limits
  • Storing things in the DOM mean you'll have to transmit everything over the wire, incurring extra bandwidth costs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top