mirror of
https://github.com/metosin/reitit.git
synced 2026-01-17 03:39:02 +00:00
Update README
This commit is contained in:
parent
853b7ac24b
commit
8ce6d4e414
1 changed files with 7 additions and 7 deletions
14
README.md
14
README.md
|
|
@ -65,7 +65,7 @@ Same routes flattened:
|
||||||
|
|
||||||
## Routing
|
## Routing
|
||||||
|
|
||||||
For routing, a `Router` is needed. Reitit ships with 2 different router implementations: `LinearRouter` and `LookupRouter`, both based on the awesome [Pedestal](https://github.com/pedestal/pedestal/tree/master/route) implementation.
|
For routing, a `Router` is needed. Reitit ships with 2 different router implementations: `:linear-router` and `:lookup-router`, both based on the awesome [Pedestal](https://github.com/pedestal/pedestal/tree/master/route) implementation.
|
||||||
|
|
||||||
`Router` is created with `reitit.core/router`, which takes routes and optional options map as arguments. The route-tree gets expanded, optionally coerced and compiled. `Router` support both fast path- and name-based lookups.
|
`Router` is created with `reitit.core/router`, which takes routes and optional options map as arguments. The route-tree gets expanded, optionally coerced and compiled. `Router` support both fast path- and name-based lookups.
|
||||||
|
|
||||||
|
|
@ -81,11 +81,11 @@ Creating a router:
|
||||||
["/user/:id" ::user]]]))
|
["/user/:id" ::user]]]))
|
||||||
```
|
```
|
||||||
|
|
||||||
`LinearRouter` is created (as there are wildcard):
|
`:linear-router` is created (as there are wildcard):
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
(class router)
|
(reitit/router-type router)
|
||||||
; reitit.core.LinearRouter
|
; :linear-router
|
||||||
```
|
```
|
||||||
|
|
||||||
The expanded routes:
|
The expanded routes:
|
||||||
|
|
@ -224,11 +224,11 @@ Simple [Ring](https://github.com/ring-clojure/ring)-based routing app:
|
||||||
["/ping" handler])))
|
["/ping" handler])))
|
||||||
```
|
```
|
||||||
|
|
||||||
Backed by a `LookupRouter` (as no wildcards found):
|
Backed by a `:lookup-router` (as no wildcards found):
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
(-> app (ring/get-router) class)
|
(-> app (ring/get-router) (reitit/router-type))
|
||||||
; reitit.core.LookupRouter
|
; :lookup-router
|
||||||
```
|
```
|
||||||
|
|
||||||
The expanded routes:
|
The expanded routes:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue