mirror of
https://github.com/metosin/reitit.git
synced 2025-12-19 01:11:11 +00:00
14 lines
405 B
Clojure
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})))
|