mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 08:21:11 +00:00
19 lines
1.3 KiB
Markdown
19 lines
1.3 KiB
Markdown
|
|
# Different Routers
|
||
|
|
|
||
|
|
Reitit ships with several different implementations for the `Router` protocol, originally based on the [Pedestal](https://github.com/pedestal/pedestal/tree/master/route) implementation. `router` selects the most suitable implementation by inspecting the expanded routes. The implementation can be set manually using `:router` option, see [configuring routers](advanced/configuring_routers.md).
|
||
|
|
|
||
|
|
| router | description |
|
||
|
|
| ------------------------------|-------------|
|
||
|
|
| `:linear-router` | Matches the routes one-by-one starting from the top until a match is found. Works with any kind of routes.
|
||
|
|
| `:lookup-router` | Fast router, uses hash-lookup to resolve the route. Valid if no paths have path or catch-all parameters.
|
||
|
|
| `:mixed-router` | Creates internally a `:linear-router` and a `:lookup-router` and used them to effectively get best-of-both-worlds. Valid if there are no [Route conflicts](../basics/route_conflicts.md).
|
||
|
|
| `::single-static-path-router` | Fastest possible router: valid only if there is one static route.
|
||
|
|
| `:prefix-tree-router` | TODO: https://github.com/julienschmidt/httprouter#how-does-it-work
|
||
|
|
|
||
|
|
The router name can be asked from the router
|
||
|
|
|
||
|
|
```clj
|
||
|
|
(r/router-name router)
|
||
|
|
; :mixed-router
|
||
|
|
```
|