summaryrefslogtreecommitdiffstats
path: root/src/app.phel
blob: 8bb61c1790225b112bf34368f6cc24a1bacf7c21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(ns lezer.app
  (:require lezer.controller.routes)
  (: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 router))

(when-not *build-mode*
  (h/emit-response (app (h/request-from-globals))))