CSCI 3342 Web Development
Fall 2024

Session and Security

Cookies and Session

Keep in touch
Continuing in the same working directory, start session.js with node. Follow the video below to complete the cookies and session example.

Cookies and Session (28:45)

Video from a prior semester. Errors and updates:
  • Changed template engines from handlebars to EJS. In these examples, just swapping from {{ }} to <%= %>.
  • In my templates I prefix several variables with locals. (e.g. locals.nameFromCookie instead of just nameFromCookie). This prevents it from erroring before I create that variable in the example, and doesn't change anything else.
  • The example includes introducing form/POST, which we've already covered this go around. Just play along.
Additional resources:

Assignment Checklist

install the cookie-parser and express-session modules with npm
Store and retreive the form data across multiple requests using a cookie
Store and retreive the form data across multiple requests using a session