In the preceding recipe, we took the following steps to store information in a session:
- The withSession function introduces the session lens into the handler. At the end of the request, the withSession function commits the changes to the session.
- The with function allows us to use the session functions in the handler.
- The function setInSession allows us to set a key to the value that we would like.
- The function getFromSession allows us to get a key if it is present in the session.
- We use initCookieManager to initialize the cookie-based session manager supplied with the snap framework. The cookie manager is configured with site_key.txt, a file where a private encoding key for the session manager will be stored, the name of ...