reitit/examples/just-coercion-with-ring/src/example/schema.clj
2017-12-09 23:21:03 +02:00

14 lines
393 B
Clojure

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