add ui
CI / Test + coverage (push) Successful in 1m15s

This commit is contained in:
2026-09-19 06:49:28 -09:00
parent 0e3ea5a714
commit a46428a757
20 changed files with 529 additions and 30 deletions
+10 -4
View File
@@ -12,6 +12,7 @@
[reitit.ring.middleware.muuntaja :as muuntaja-middleware]
[reitit.ring.middleware.parameters :as parameters]
[muuntaja.core :as m]
[ring.util.response :as response]
[tbd.health.routes :as health]
[tbd.math.routes :as math]))
@@ -34,6 +35,12 @@
:body (pr-str {:error "invalid request parameters"
:details (:humanized (reitit.coercion/encode-error (ex-data e)))})})
(defn- index-handler
"The HTML shell for the re-frame UI (ui/); it loads the compiled JS from /js."
[_req]
(-> (response/resource-response "public/index.html")
(response/content-type "text/html; charset=utf-8")))
(def ^:private exception-middleware
(exception/create-exception-middleware
(assoc exception/default-handlers
@@ -48,10 +55,7 @@
:swagger {:info {:title "tbd API" :version "1.0.0"}}
:handler (swagger-handler)}}]
["/" {:get {:no-doc true
:handler (fn [_req]
{:status 200
:headers {"Content-Type" "text/plain; charset=utf-8"}
:body "tbd API — see /api-docs for documentation, /swagger.json for the spec"})}}]
:handler index-handler}}]
(health/routes)
(math/routes)]
{:data {:muuntaja m/instance
@@ -66,6 +70,8 @@
router
(ring/routes
(swagger-ui/create-swagger-ui-handler {:path "/api-docs"})
;; Compiled UI (script/ui-build writes resources/public/js).
(ring/create-resource-handler {:path "/js" :root "public/js"})
(ring/create-default-handler)))
wrap-head))