Express Session with MongoDB

Viewed 17

I am trying to create a web application where different users can login and change their favourite food preference. However, I am having a lot of trouble understanding sessions.

I've created a register page that registers users and saves it into mongoDB. However, I'm not sure how to incorporate sessions so that when a user logins, the application knows which user has logged in and when the user modifies their food list, changes are made.

Would I create a session when a user registers and store that into the database? I'm just not grasping how everything is connected together.

Any clarification would be great.

0 Answers
Related