From 4ea0dc2600e486d22390d0bb95c315d268ad46e5 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 11 Nov 2017 17:50:27 +0200 Subject: [PATCH] Fix typos & unfinished sentences --- doc/advanced/different_routers.md | 2 +- doc/ring/data_driven_middleware.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/advanced/different_routers.md b/doc/advanced/different_routers.md index 98e01654..87bbd532 100644 --- a/doc/advanced/different_routers.md +++ b/doc/advanced/different_routers.md @@ -7,7 +7,7 @@ Reitit ships with several different implementations for the `Router` protocol, o | `: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. +| `: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: diff --git a/doc/ring/data_driven_middleware.md b/doc/ring/data_driven_middleware.md index 23f76f1b..f4477621 100644 --- a/doc/ring/data_driven_middleware.md +++ b/doc/ring/data_driven_middleware.md @@ -1,17 +1,17 @@ # Data-driven Middleware -Ring [defines middleware](https://github.com/ring-clojure/ring/wiki/Concepts#middleware) as a function of type `handler & opts => request => response`. It's easy to undrstand and enables great performance, but makes the middleware-chain opaque, making things like documentation and debugging hard. +Ring [defines middleware](https://github.com/ring-clojure/ring/wiki/Concepts#middleware) as a function of type `handler & args => request => response`. It's easy to undrstand and enables great performance. Still, in the end - the middleware-chain is just a opaque function, making things like documentation and debugging hard. Reitit does things bit differently: -1. middleware is defined as a vector (of middleware) enabling the chain to be malipulated before turned into the optimized runtime chain. -2. middleware can be defined as first-class data entries +1. Middleware is defined as a vector (of middleware) enabling the chain to be malipulated before turned into the runtime middleware function. +2. Middleware can be defined as first-class data entries ### Middleware as data -Everything that is defined inside the `:middleware` vector in the route data is coerced into `reitit.ring.middleware/Middleware` Records with the help of `reitit.ring.middleware/IntoMiddleware` Protocol. By default, it transforms functions, maps and `Middleware` records. For the actual +All values in the `:middleware` vector in the route data are coerced into `reitit.ring.middleware/Middleware` Records with using the `reitit.ring.middleware/IntoMiddleware` Protocol. By default, functions, maps and `Middleware` records are allowed. -Records can have arbitrary keys, but the default keys have a special purpose: +Records can have arbitrary keys, but the following keys have a special purpose: | key | description | | ------------|-------------| @@ -21,7 +21,7 @@ Records can have arbitrary keys, but the default keys have a special purpose: Middleware Records are accessible in their raw form in the compiled route results, thus available for inventories, creating api-docs etc. -For the actual request processing, the Records are unwrapped into normal functions, yielding zero runtime penalty. +For the actual request processing, the Records are unwrapped into normal functions and composed into a middleware function chain, yielding zero runtime penalty. ### Creating Middleware