From 5390086d7f1bfcb796466f96836f37710fcaec2b Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 11 Nov 2017 16:52:32 +0200 Subject: [PATCH] Fix docs --- doc/advanced/different_routers.md | 21 ++++++++++++++------- doc/advanced/route_validation.md | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/advanced/different_routers.md b/doc/advanced/different_routers.md index ae742760..98e01654 100644 --- a/doc/advanced/different_routers.md +++ b/doc/advanced/different_routers.md @@ -1,18 +1,25 @@ # 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). +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` function 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 +| `:linear-router` | Matches the routes one-by-one starting from the top until a match is found. Works with any kind of routes. Slow, but works with all route trees. +| `: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](../basics/route_conflicts.md). +| `:mixed-router` | Creates internally a `:prefix-tree-router` and a `:lookup-router` and used them to effectively get best-of-both-worlds. Valid only if there are no [Route conflicts](../basics/route_conflicts.md). +| `::single-static-path-router` | Super fast router: sting-matches the route. Valid only if there is one static route. +| `:prefix-tree-router` | Router that creates a [prefix-tree](https://en.wikipedia.org/wiki/Radix_tree) out of an route table. Much faster than `:linear-router`. Valid only if there are no [Route conflicts](../basics/route_conflicts.md). -The router name can be asked from the router +The router name can be asked from the router: ```clj +(require '[reitit.core :as r]) + +(def router + (r/router + [["/ping" ::ping] + ["/api/:users" ::users]])) + (r/router-name router) ; :mixed-router ``` diff --git a/doc/advanced/route_validation.md b/doc/advanced/route_validation.md index 80ef1bcd..90a84222 100644 --- a/doc/advanced/route_validation.md +++ b/doc/advanced/route_validation.md @@ -5,7 +5,7 @@ Namespace `reitit.spec` contains [clojure.spec](https://clojure.org/about/spec) **NOTE:** Use of specs requires to use one of the following: * `[org.clojure/clojurescript "1.9.660"]` (or higher) -* `[org.clojure/clojure "1.9.0-beta2"]` (or higher) +* `[org.clojure/clojure "1.9.0-RC1"]` (or higher) * `[clojure-future-spec "1.9.0-alpha17"]` (if Clojure 1.8 is used) ## Example