summaryrefslogtreecommitdiffstats
path: root/src/app.phel
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-08-25 23:02:08 -0700
committerGravatar Tom Willemse2026-08-25 23:02:08 -0700
commit9d4733413c791c8e4f589a197a0da91dad279740 (patch)
tree42ae877b286de0a66ccd17efbcb258f5ea07b823 /src/app.phel
parent8bf0bca2c77a4af53002f43941fe634f3c12ef56 (diff)
downloadlezer-9d4733413c791c8e4f589a197a0da91dad279740.tar.gz
lezer-9d4733413c791c8e4f589a197a0da91dad279740.zip
Add author page
Diffstat (limited to 'src/app.phel')
-rw-r--r--src/app.phel19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/app.phel b/src/app.phel
index ac3b94e..8bb61c1 100644
--- a/src/app.phel
+++ b/src/app.phel
@@ -3,14 +3,19 @@
(:require phel.router :as r)
(:require phel.http :as h))
+(def- router
+ (r/router
+ [["/" {:handler (fn [req]
+ (routes/index-handler req router))}]
+ ["/ping" {:name ::ping
+ :get {:handler routes/ping-handler}
+ :post {:handler routes/ping-handler}}]
+ ["/book" {:post {:handler routes/book-create-handler}}]
+ ["/author/{id}" {:name :author
+ :get {:handler routes/author-view-handler}}]]))
+
(def app
- (r/handler
- (r/router
- [["/" {:handler routes/index-handler}]
- ["/ping" {:name ::ping
- :get {:handler routes/ping-handler}
- :post {:handler routes/ping-handler}}]
- ["/book" {:post {:handler routes/book-create-handler}}]])))
+ (r/handler router))
(when-not *build-mode*
(h/emit-response (app (h/request-from-globals))))