[back/feat] coercion request params
This commit is contained in:
parent
f18f20d12b
commit
160147ad8e
1 changed files with 13 additions and 4 deletions
|
@ -1,6 +1,10 @@
|
||||||
(ns backend.core
|
(ns backend.core
|
||||||
(:require [org.httpkit.server :as server]
|
(:require [org.httpkit.server :as server]
|
||||||
[reitit.ring :as ring]
|
[reitit.ring :as ring]
|
||||||
|
[reitit.ring.middleware.parameters :as parameters]
|
||||||
|
[reitit.coercion.schema]
|
||||||
|
[schema.core :as s]
|
||||||
|
[reitit.ring.coercion :as rrc]
|
||||||
[backend.handlers :as handlers]
|
[backend.handlers :as handlers]
|
||||||
[backend.page :as page]
|
[backend.page :as page]
|
||||||
[backend.hugo.site :as hugo])
|
[backend.hugo.site :as hugo])
|
||||||
|
@ -12,13 +16,18 @@
|
||||||
(ring/router
|
(ring/router
|
||||||
[["/" {:parameters {}
|
[["/" {:parameters {}
|
||||||
:get {:handler page/frontend-page}}]
|
:get {:handler page/frontend-page}}]
|
||||||
["/hp/:id" {:parameters {:path {:id int?}}
|
["/hp/:id" {:parameters {:path {:id s/Int}}
|
||||||
:get {:handler hugo/build-hugo-post}}]
|
:get {:handler hugo/build-hugo-post}}]
|
||||||
["/api"
|
["/api"
|
||||||
["/hp/:id" {:parameters {:path {:id int?}}
|
["/hp/:id" {:parameters {:path {:id s/Int}}
|
||||||
:get {:handler handlers/build-api-hu-post}}]
|
:get {:handler handlers/build-api-hu-post}}]
|
||||||
["/hq/:id" {:parameters {:path {:id int?}}
|
["/hq/:id" {:parameters {:path {:id s/Int}
|
||||||
:get {:handler handlers/build-api-hu-question}}]]])
|
:query {:session_id s/Int}}
|
||||||
|
:get {:handler handlers/build-api-hu-question}}]]]
|
||||||
|
{:data {:coercion reitit.coercion.schema/coercion
|
||||||
|
:middleware [parameters/parameters-middleware
|
||||||
|
rrc/coerce-request-middleware]}})
|
||||||
|
|
||||||
(ring/routes
|
(ring/routes
|
||||||
(ring/create-resource-handler {:path "/"})
|
(ring/create-resource-handler {:path "/"})
|
||||||
(ring/create-default-handler
|
(ring/create-default-handler
|
||||||
|
|
Loading…
Reference in a new issue