+10
-4
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user