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

15 lines
393 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]
2017-12-03 15:43:57 +00:00
[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})))