mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Cleanup examples
This commit is contained in:
parent
ae75021aac
commit
509697dc55
6 changed files with 15 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
(defproject just-coercion-with-ring "0.1.0-SNAPSHOT"
|
||||
:description "Reitit coercion with vanilla ring"
|
||||
:dependencies [[org.clojure/clojure "1.9.0-RC2"]
|
||||
:dependencies [[org.clojure/clojure "1.9.0"]
|
||||
[ring "1.6.3"]
|
||||
[metosin/muuntaja "0.4.1"]
|
||||
[metosin/reitit "0.1.0-SNAPSHOT"]])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
(ns example.server
|
||||
(:require [ring.adapter.jetty :as jetty]
|
||||
[muuntaja.middleware]
|
||||
[ring.middleware.params]
|
||||
[reitit.middleware :as middleware]
|
||||
[reitit.ring.coercion :as rrc]))
|
||||
|
||||
|
|
@ -10,9 +12,9 @@
|
|||
;; to be set with :extract-request-format and extract-response-format
|
||||
(defn wrap-coercion [handler resource]
|
||||
(middleware/chain
|
||||
[rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware
|
||||
rrc/coerce-exceptions-middleware]
|
||||
[rrc/coerce-exceptions-middleware
|
||||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware]
|
||||
handler
|
||||
resource))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(defproject just-coercion-with-ring "0.1.0-SNAPSHOT"
|
||||
:description "Reitit coercion with vanilla ring"
|
||||
:dependencies [[org.clojure/clojure "1.9.0-RC2"]
|
||||
(defproject ring-example "0.1.0-SNAPSHOT"
|
||||
:description "Reitit Ring App"
|
||||
:dependencies [[org.clojure/clojure "1.9.0"]
|
||||
[ring "1.6.3"]
|
||||
[metosin/muuntaja "0.4.1"]
|
||||
[metosin/reitit "0.1.0-SNAPSHOT"]])
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(ns example.dspec
|
||||
(:require [reitit.coercion.spec :as spec-coercion]))
|
||||
(:require [reitit.coercion.spec]))
|
||||
|
||||
(def routes
|
||||
["/dspec" {:coercion spec-coercion/coercion}
|
||||
["/dspec" {:coercion reitit.coercion.spec/coercion}
|
||||
["/plus" {:name ::plus
|
||||
:responses {200 {:schema {:total int?}}}
|
||||
:get {:summary "plus with query-params"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
(ns example.schema
|
||||
(:require [schema.core :as s]
|
||||
[reitit.coercion.schema :as schema-coercion]))
|
||||
[reitit.coercion.schema]))
|
||||
|
||||
(def routes
|
||||
["/schema" {:coercion schema-coercion/coercion}
|
||||
["/schema" {:coercion reitit.coercion.schema/coercion}
|
||||
["/plus" {:name ::plus
|
||||
:responses {200 {:schema {:total s/Int}}}
|
||||
:get {:summary "plus with query-params"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
(ns example.spec
|
||||
(:require [clojure.spec.alpha :as s]
|
||||
[spec-tools.spec :as spec]
|
||||
[reitit.coercion.spec :as spec-coercion]))
|
||||
[reitit.coercion.spec]))
|
||||
|
||||
;; wrap into Spec Records to enable runtime conforming
|
||||
(s/def ::x spec/int?)
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
(s/def ::total spec/int?)
|
||||
|
||||
(def routes
|
||||
["/spec" {:coercion spec-coercion/coercion}
|
||||
["/spec" {:coercion reitit.coercion.spec/coercion}
|
||||
["/plus" {:name ::plus
|
||||
:responses {200 {:schema (s/keys :req-un [::total])}}
|
||||
:get {:summary "plus with query-params"
|
||||
|
|
|
|||
Loading…
Reference in a new issue