mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
1) use `:update-paths` to handle data in certain (loose) paths differently - accumulate schemas in all relevant routers into vector - we do not know the coercion here (ring/http have special handling of data, e.g. http-methods) 2) run coercion compiler for the model to merge the effective model - schema + malli = should work ok, spec = best effort 3) publish final schemas into compiled route data
1.5 KiB
1.5 KiB
Configuring Routers
Routers can be configured via options. The following options are available for the reitit.core/router:
| key | description |
|---|---|
:path |
Base-path for routes |
:routes |
Initial resolved routes (default []) |
:data |
Initial route data (default {}) |
:spec |
clojure.spec definition for a route data, see reitit.spec on how to use this |
:syntax |
Path-parameter syntax as keyword or set of keywords (default #{:bracket :colon}) |
:expand |
Function of arg opts => data to expand route arg to route data (default reitit.core/expand) |
:coerce |
Function of route opts => route to coerce resolved route, can throw or return nil |
:compile |
Function of route opts => result to compile a route handler |
:validate |
Function of routes opts => () to validate route (data) via side-effects |
:conflicts |
Function of {route #{route}} => () to handle conflicting routes |
:exception |
Function of Exception => Exception to handle creation time exceptions (default reitit.exception/exception) |
:meta-merge |
Function of left right => merged to merge route-data (default meta-merge.core/meta-merge) |
:update-paths |
Sequence of Vectors with elements update-path and function, used to preprocess route data |
:router |
Function of routes opts => router to override the actual router implementation |