Liking cljdoc? Tell your friends :D

Default Middleware

[metosin/reitit-middleware "0.7.1"]

Any Ring middleware can be used with reitit-ring, but using data-driven middleware is preferred as they are easier to manage and in many cases yield better performance. reitit-middleware contains a set of common ring middleware, lifted into data-driven middleware.

Parameters Handling

reitit.ring.middleware.parameters/parameters-middleware to capture query- and form-params. Wraps ring.middleware.params/wrap-params.

NOTE: This middleware will be factored into two parts: a query-parameters middleware and a Muuntaja format responsible for the the application/x-www-form-urlencoded body format. cf. https://github.com/metosin/reitit/issues/134

Exception Handling

See Exception Handling with Ring.

Content Negotiation

See Content Negotiation.

Multipart Request Handling

Wrapper for Ring Multipart Middleware. Emits swagger :consumes definitions automatically.

Expected route data:

keydescription
[:parameters :multipart]mounts only if defined for a route.
(require '[reitit.ring.middleware.multipart :as multipart])
  • multipart/multipart-middleware a preconfigured middleware for multipart handling
  • multipart/create-multipart-middleware to generate with custom configuration

Inspecting Middleware Chain

reitit.ring.middleware.dev/print-request-diffs is a middleware chain transforming function. It prints a request and response diff between each middleware. To use it, add the following router option:

:reitit.middleware/transform reitit.ring.middleware.dev/print-request-diffs

Partial sample output:

Opensensors perf test

Example app

See an example app with the default middleware in action: https://github.com/metosin/reitit/blob/master/examples/ring-malli-swagger/src/example/server.clj.

Can you improve this documentation? These fine people already did:
Tommi Reiman, Juho Teperi, Miikka Koskinen, Joel Kaasinen, tjalkane, Marcus Spiegel, Dennis Schridde, Phil Hofmann, J Hacksworth & Wanderson Ferreira
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close