BunJS MVC Framework Demonstration

Session Variables & Models Demo

If the NAME below is empty, then the session variable has just been written. Refresh the page to see the 12 hour persistence.

Note: Only this user's session can access this data.

NAME:

Note: We utilized a models/session.js model to carry out the task.

Also, stale session cleanup runs randomly 1:4 on session writes, and removes sessions older than 12 hours.

Because the data is stored in server memory and not in a database or file, it is not recommended to store large amounts of data in a session variable -- just small things like login profile information and other small settings.

Note that we have a special NGINX configuration that makes sessions possible. Look at the NGINX config file for this project.