This commit is contained in:
2026-03-21 19:58:17 -06:00
parent ce1fd5dce5
commit 46c7c5d45c
2 changed files with 34 additions and 16 deletions

View File

@@ -11,7 +11,7 @@
[reitit.ring.coercion]
[reitit.core :as r]
[reitit.ring]
[reitit.ring.middleware.exception]
[reitit.ring.middleware.exception :as reitit-exception]
[ring.util.response :as response]
[spec-tools.spell]
[reitit.spec]
@@ -39,17 +39,18 @@
(defn node-by-slug [{{{:keys [slug]} :path} :parameters}]
(-> (hiccup/html {}
[:html
[:head
[:title "node by sluggg"]
doerg-html/charset
doerg-html/viewport]
[:body
[:h1 "node by slug"]
[:pre
(with-out-str
(pprint (-> slug slug/from-string roam/get-node
roam/org-file)))]]])
[:html
[:head
[:title "node by sluggg"]
doerg-html/charset
doerg-html/viewport]
[:body
[:h1 "node by slug"]
[:pre
(-> slug slug/from-string roam/get-node
roam/org-file doerg-render/to-html)]]])
#_(-> slug slug/from-string roam/get-node
roam/org-file doerg-render/to-html)
str
response/response
(response/content-type "text/html")))
@@ -57,6 +58,15 @@
(defn node-by-id [req]
(hello req))
(def exception-middleware
(reitit-exception/create-exception-middleware
(merge
reitit-exception/default-handlers
{::reitit-exception/wrap
(fn [handler e request]
(l/error e "error in fucking somwhere dude")
(handler e request))})))
(def router
(reitit.ring/router
#{["/" {:get hello}]
@@ -70,7 +80,7 @@
:spec (s/merge :reitit.spec/default-data)
:data
{:coercion reitit.coercion.spec/coercion
:middleware [reitit.ring.middleware.exception/exception-middleware
:middleware [exception-middleware
reitit.ring.coercion/coerce-request-middleware
reitit.ring.coercion/coerce-response-middleware
#_reitit.ring.coercion/coerce-exceptions-middleware]}}))