practicalli / clojure-web-services

Develop production grade server-side web services and APIs using Clojure and REPL driven development
https://practical.li/clojure-web-services
Creative Commons Attribution Share Alike 4.0 International
11 stars 14 forks source link

Compojure rest app and cookies #7

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

https://github.com/bakku/clj-rest-web-app

A session stores the currently logged in user ID, configured the ring-session middleware to use a cookie store. After restarting the server the session is refreshed as if it is not using any cookie store.

By default Ring uses an in-memory session store. you can change it to store data in a cookie or something persistent like Redis https://github.com/ring-clojure/ring/wiki/Sessions#session-stores (edited) Its configured it to store the data in a cookie using the site-defaults from ring which already wrapped my routes using the session middleware but the site-defaults are using the in-memory session. I had to update the session configuration of the site-defaults according to my needs to get it to work