luminus

Mark McWiggins 2021-05-14T20:07:05.024500Z

Anybody got a complete example with Luminus on cookie handling? This is the last step to be able to publish my first Clojure app and I am missing something. Thanks.

Mark McWiggins 2021-05-15T22:05:19.024800Z

Yes, ... background of what I'm doing:

Mark McWiggins 2021-05-15T22:06:15.025200Z

I just want to have the user pick a level and represent that in the code ... I have the actions set up correctly, but getting the information in is my question:

Mark McWiggins 2021-05-15T22:06:30.025400Z

(1) Better to use a cookie or an atom?

Mark McWiggins 2021-05-15T22:06:47.025600Z

(2) If a cookie: what's the syntax in Luminus for:

Mark McWiggins 2021-05-15T22:06:56.025800Z

(a) setting a cookie

Mark McWiggins 2021-05-15T22:07:16.026Z

(b) getting a cookie value back to use in the code

Mark McWiggins 2021-05-15T22:07:26.026200Z

Thanks much for any suggestions!

tobias 2021-05-16T13:12:53.026400Z

Hey @mark549, I've added a couple of routes and handlers to demonstrate setting and retrieving a cookie: https://github.com/jtlocsei/hello-world-web-app/commit/d7afdb420d2765ca97d6befe831bf454ca581c5b

tobias 2021-05-16T13:15:00.026600Z

You probably already know this but you can inspect cookies in Chrome to see what's going on while you're debugging: https://developer.chrome.com/docs/devtools/storage/cookies/

tobias 2021-05-16T13:34:34.026900Z

Live demo: https://guessing-game.mircloud.us/math/choose-level A cookie is used to store chosen difficulty level, and the question you get on the next page depends on the difficulty level you chose.

Mark McWiggins 2021-05-16T15:54:54.027100Z

Thanks!