add route for thoughts/blog

This commit is contained in:
2025-05-11 15:36:23 -07:00
parent 77fd26b8c7
commit d323b8fcbe

View File

@ -8,6 +8,9 @@
(import bleach [clean]) (import bleach [clean])
(import validators [domain :as domain?]) (import validators [domain :as domain?])
(defmacro unless [test #* body]
`(when (not ~test) (do ~@body)))
(defn error [code message] (defn error [code message]
(return (dict (return (dict
:code code :code code
@ -30,9 +33,14 @@
(return (error 405 "method not allowed"))) (return (error 405 "method not allowed")))
(when (file? (+ "./www/site/html" path)) (when (file? (+ "./www/site/html" path))
(unless (= path "/html/view-thought.html")
(return (dict
:code 200
:body (parse-html-file f"./www/site/html{path}"))))
(return (dict (return (dict
:code 200 :code 200
:body (parse-html-file f"./www/site/html{path}"))))) :body (parse-html-file "./www/site/html/html/view-thought.html" #** (. request (get "route") (get "parameters")))))))
(when (= path "/style.css") (when (= path "/style.css")
(when (!= method "GET") (when (!= method "GET")