Without producing any JavaScript, the way someone using a web browser can send data back to a server is with a form submit.
src/example/cave/routes.clj
.(ns example.cave.routes
(:require [hiccup2.core :as hiccup]))
(defn cave-create-handler
[_system _request]
{:status 200
:headers {"Content-Type" "text/html"}
:body (str
(hiccup/html
[:html
[:body
[:h1 "TODO"]]]))})
(defn cave-handler
[_system _request]
{:status 200
:headers {"Content-Type" "text/html"}
:body (str
(hiccup/html
[:html
[:body
[:h1 "Create a new cave"]
[:form {:method "post"
:action "/cave/create"}
[:label {:for "description"} "Description"]
[:input {:name "description" :type "text"}]
[:input {:type "submit"}]]]]))})
(defn routes
[system]
[["/cave" {:get {:handler (partial #'cave-handler system)}}]
["/cave/create" {:post {:handler (partial #'cave-create-handler system)}}]])
src/example/routes.clj
(ns example.routes
(:require [clojure.tools.logging :as log]
[example.cave.routes :as cave-routes]
[example.goodbye.routes :as goodbye-routes]
[example.hello.routes :as hello-routes]
[hiccup2.core :as hiccup]
[reitit.ring :as reitit-ring]))
(defn routes
[system]
[""
(cave-routes/routes system)
(hello-routes/routes system)
(goodbye-routes/routes system)])
...
/cave
and test out the form.You should land on /cave/create
with TODO
on the screen. We'll loop back to this
after making some middleware.