reitit/examples/just-coercion-with-ring/src/example/schema.clj
2018-06-10 23:10:46 +03:00

14 lines
405 B
Clojure

(ns example.schema
(:require [reitit.coercion.schema :as schema-coercion]
[example.middleware :as middleware]))
(defn handler [{{{:keys [x y]} :query} :parameters}]
{:status 200
:body {:result (+ x y)
:source :schema}})
(def app
(-> #'handler
(middleware/wrap-coercion
{:parameters {:query {:x Long, :y Long}}
:coercion schema-coercion/coercion})))