mirror of
https://github.com/metosin/reitit.git
synced 2026-02-08 12:53:12 +00:00
parameters-middleware & polish sample
This commit is contained in:
parent
7ecc2178c5
commit
1094e7d240
1 changed files with 7 additions and 5 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
[reitit.ring.middleware.muuntaja :as muuntaja]
|
[reitit.ring.middleware.muuntaja :as muuntaja]
|
||||||
[reitit.ring.middleware.exception :as exception]
|
[reitit.ring.middleware.exception :as exception]
|
||||||
[reitit.ring.middleware.multipart :as multipart]
|
[reitit.ring.middleware.multipart :as multipart]
|
||||||
[ring.middleware.params :as params]
|
[reitit.ring.middleware.parameters :as parameters]
|
||||||
[ring.adapter.jetty :as jetty]
|
[ring.adapter.jetty :as jetty]
|
||||||
[muuntaja.core :as m]
|
[muuntaja.core :as m]
|
||||||
[clojure.java.io :as io]))
|
[clojure.java.io :as io]))
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
(ring/router
|
(ring/router
|
||||||
[["/swagger.json"
|
[["/swagger.json"
|
||||||
{:get {:no-doc true
|
{:get {:no-doc true
|
||||||
:swagger {:info {:title "my-api"}}
|
:swagger {:info {:title "my-api"
|
||||||
|
:description "with reitit-ring"}}
|
||||||
:handler (swagger/create-swagger-handler)}}]
|
:handler (swagger/create-swagger-handler)}}]
|
||||||
|
|
||||||
["/files"
|
["/files"
|
||||||
|
|
@ -38,8 +39,9 @@
|
||||||
:handler (fn [_]
|
:handler (fn [_]
|
||||||
{:status 200
|
{:status 200
|
||||||
:headers {"Content-Type" "image/png"}
|
:headers {"Content-Type" "image/png"}
|
||||||
:body (io/input-stream
|
:body (-> "reitit.png"
|
||||||
(io/resource "reitit.png"))})}}]]
|
(io/resource)
|
||||||
|
(io/input-stream))})}}]]
|
||||||
|
|
||||||
["/math"
|
["/math"
|
||||||
{:swagger {:tags ["math"]}}
|
{:swagger {:tags ["math"]}}
|
||||||
|
|
@ -61,7 +63,7 @@
|
||||||
{:data {:coercion reitit.coercion.spec/coercion
|
{:data {:coercion reitit.coercion.spec/coercion
|
||||||
:muuntaja m/instance
|
:muuntaja m/instance
|
||||||
:middleware [;; query-params & form-params
|
:middleware [;; query-params & form-params
|
||||||
params/wrap-params
|
parameters/parameters-middleware
|
||||||
;; content-negotiation
|
;; content-negotiation
|
||||||
muuntaja/format-negotiate-middleware
|
muuntaja/format-negotiate-middleware
|
||||||
;; encoding response body
|
;; encoding response body
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue