Reitit ships with several different implementations for the Router protocol, originally based on the Pedestal implementation. router function selects the most suitable implementation by inspecting the expanded routes. The implementation can be set manually using :router option, see configuring routers.
| router | description | 
|---|---|
| :linear-router | Matches the routes one-by-one starting from the top until a match is found. Slow, but works with all route trees. | 
| :trie-router | Router that creates a optimized search trie out of an route table. Much faster than :linear-routerfor wildcard routes. Valid only if there are no Route conflicts. | 
| :lookup-router | Fast router, uses hash-lookup to resolve the route. Valid if no paths have path or catch-all parameters and there are no Route conflicts. | 
| :single-static-path-router | Super fast router: string-matches a route. Valid only if there is one static route. | 
| :mixed-router | Contains two routers: :trie-routerfor wildcard routes and a:lookup-routeror:single-static-path-routerfor static routes. Valid only if there are no Route conflicts. | 
| :quarantine-router | Contains two routers: :mixed-routerfor non-conflicting routes and a:linear-routerfor conflicting routes. | 
The router name can be asked from the router:
(require '[reitit.core :as r])
(def router
  (r/router
    [["/ping" ::ping]
     ["/api/:users" ::users]]))
(r/router-name router)
; :mixed-router
Overriding the router implementation:
(require '[reitit.core :as r])
(def router
  (r/router
    [["/ping" ::ping]
     ["/api/:users" ::users]]
    {:router r/linear-router}))
(r/router-name router)
; :linear-router
Can you improve this documentation? These fine people already did:
Tommi Reiman & Raphaël SaunierEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |