mirror of
https://github.com/metosin/reitit.git
synced 2025-12-25 19:28:26 +00:00
1.4 KiB
1.4 KiB
Pedestal
Pedestal is a well known interceptor implmementation for Clojure. To use reitit-http with it, we need to change the default routing interceptor into a new one. Currently, there isn't a separate Pedestal-module in reitit, but the examples have the example code how to do this.
Caveat
reitit-http defines Interceptors as reitit.interceptor/Interceptor. Compared to Pedestal (2-arity), reitit uses a simplified (1-arity) model for handling errors, described in the Sieppari README.
- you can use any pedestal-style interceptor within reitit router (as Pedestal is executing those anyway)
- you can use any reitit-style interceptor that doesn't have
:error-stage defined - using a reitit-style interceptor with
:errordefined will causeArityExceptionif invoked
See the error handling guide on how to handle errors with Pedestal.
Examples
Simple
- simple example, with both sync & async code:
With batteries
- with default interceptors, coercion and swagger-support (note: exception handling is disabled):