Domanda

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?

È stato utile?

Soluzione

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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top