PHP , for example, stores session data on the server, that is, it creates a file with an identifier, and writes session values ​​to it in serialized form ( $_SESSION['foo']='bar' )

In NodeJS everything is different: a file with an identifier is also created, but the values ​​are not written to it , but written to the request object ( req.session.foo = 'bar' ). Session file:

 { "cookie": { "originalMaxAge":null, "expires":null, "httpOnly":true, "path":"/"}, "__lastAccess":1479380096570 } } 

Only service information.

It turns out, here the values ​​of the sessions are recorded at the client? But how?! Perhaps I do not fully understand the object req ...

  • one
    What library do you use for sessions in Node JS? - Zhukov Roman Nov.
  • Tried req.session.save(); ? - Darth

0