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

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

(def ^:private router
  (rring/router [["/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))