node.js - Node + express session data -
I am working with this boilderplate, which is the user using Express-session, Mogostore for session management .
The node document made for each session looks like this:
{"_id": "QDKVO5GM6GrNYd0SlQyTgJsx", "session": "{\" cookie \ ": True, \ "path \": \ "/ \"}, \ "passport \": {\ "originalMaxAge \": null, \ "ending \": null, \ "only Http \": { \ "User \": \ "535e005c02d3c0ed79463583 \", \ "_Csrf \" \ "\": \ "MqLJJ8qZLSk5 / w == \", \ "return \": \ "/ \", \ "flash \ ": {}}", "Expired": {"$ date": "2014-05-12T08: 27: 04.696Z"}}
is there any way Can I add data to each session? Sense data is used to store them.
Thanks,
You can add properties, and therefore data, session variables in the same way that you can do in any JavaScript object.
If you type express-session
then You have access to the req.session
variable, so that you can store data objects using
req.session.data = data;
And as long as the session survives it will be available.
Comments
Post a Comment