reitit/examples/just-coercion-with-ring/src/example/schema.clj

15 lines
405 B
Clojure
Raw Normal View History

2017-12-03 15:43:57 +00:00
(ns example.schema
2017-12-09 21:21:03 +00:00
(:require [reitit.coercion.schema :as schema-coercion]
2018-06-10 20:10:46 +00:00
[example.middleware :as middleware]))
2017-12-03 15:43:57 +00:00
(defn handler [{{{:keys [x y]} :query} :parameters}]
{:status 200
:body {:result (+ x y)
:source :schema}})
(def app
(-> #'handler
2018-06-10 20:10:46 +00:00
(middleware/wrap-coercion
2017-12-03 15:43:57 +00:00
{:parameters {:query {:x Long, :y Long}}
:coercion schema-coercion/coercion})))