reitit/doc/advanced/configuring_routers.md

17 lines
1 KiB
Markdown
Raw Normal View History

2017-12-10 16:08:00 +00:00
# Configuring Routers
2017-09-14 13:33:36 +00:00
2017-12-28 08:44:35 +00:00
Routers can be configured via options. The following options are available for the `reitit.core/router`:
2017-09-14 13:33:36 +00:00
| key | description |
| -------------|-------------|
| `:path` | Base-path for routes
| `:routes` | Initial resolved routes (default `[]`)
2017-11-18 10:47:16 +00:00
| `:data` | Initial route data (default `{}`)
2017-12-28 08:44:35 +00:00
| `:spec` | clojure.spec definition for a route data, see `reitit.spec` on how to use this
2017-11-18 10:47:16 +00:00
| `:expand` | Function of `arg opts => data` to expand route arg to route data (default `reitit.core/expand`)
2017-09-14 13:33:36 +00:00
| `: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
2017-12-28 08:44:35 +00:00
| `:validate` | Function of `routes opts => ()` to validate route (data) via side-effects
| `:conflicts` | Function of `{route #{route}} => ()` to handle conflicting routes (default `reitit.core/throw-on-conflicts!`)
2017-09-14 13:33:36 +00:00
| `:router` | Function of `routes opts => router` to override the actual router implementation