Created
May 24, 2020 06:52
-
-
Save EmmanuelOga/8b502f590bdedd5890bd65921f35b9f9 to your computer and use it in GitHub Desktop.
minimal ring session example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns anillo.core | |
| (:require [ring.adapter.jetty :refer :all] | |
| [ring.middleware.session :refer :all] | |
| [ring.util.response :refer :all])) | |
| (defn handler [{session :session}] | |
| (let [n (session :n 1)] | |
| (-> (response (str "You have visited " n " times")) | |
| (assoc-in [:session :n] (inc n))))) | |
| (def app | |
| (-> handler wrap-session)) | |
| (defn run | |
| [] | |
| (run-jetty app {:port 3000})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment