Creating and Managing Sessions using Node.js -


how can create sessions , manage them in node.js without framework express?

i know easier use express want know how node in case.

most of questions mentions managing sessions in node using express want know how without express.

as simple starting point, suppose starts sessions when user login , destroy when logout.

so when user login, create unique session-id , store session-id @ db redis/mysql @ our server, same given client next subsequent requests. (note not store session-id in memory of server, if server restart loss sessions)

so next time whenever new request come client session-id identify user , serve response on basis of session-id.

whenever user logout, remove session-id our db. can add timeout session-id.

this simple concept, can extended required.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -