mirror of
https://github.com/metosin/reitit.git
synced 2025-12-22 10:31:12 +00:00
14 lines
401 B
Clojure
14 lines
401 B
Clojure
(ns example.dspec
|
|
(:require [reitit.coercion.spec :as spec-coercion]
|
|
[example.middleware :as middleware]))
|
|
|
|
(defn handler [{{{:keys [x y]} :query} :parameters}]
|
|
{:status 200
|
|
:body {:result (+ x y)
|
|
:source :data-spec}})
|
|
|
|
(def app
|
|
(-> #'handler
|
|
(middleware/wrap-coercion
|
|
{:parameters {:query {:x int?, :y int?}}
|
|
:coercion spec-coercion/coercion})))
|