aboutsummaryrefslogtreecommitdiff
path: root/src/pics/routes.clj
blob: 31edd637f4f0e7c7a96b3d6fddaaf2b4d20f6328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(ns pics.routes
  (:require [reitit.ring :as rring]
            [ring.middleware.multipart-params :as rmmultiparams]

            [pics.handler.home :as phhome]
            [pics.handler.upload :as phupload]
            [pics.handler.view :as phview]))

(def ^:private router
  (rring/router [["/" {:get {:handler phhome/handle}}]
                 ["/api/upload" {:post {:handler phupload/handle}}]
                 ["/src/:file-name" {:get {:handler phview/handle-src}}]
                 ["/:id" {:get {:handler phview/handle}}]]))

(def ring-handler
  (-> router
      rring/ring-handler
      rmmultiparams/wrap-multipart-params))