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