mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 16:31:11 +00:00
Merge pull request #228 from alexanderjamesking/master
Update shared routes doc
This commit is contained in:
commit
70ec78a72c
1 changed files with 7 additions and 6 deletions
|
|
@ -53,15 +53,16 @@ For the backend, we can use a custom-expander to expand the routes:
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
(require '[reitit.ring :as ring])
|
(require '[reitit.ring :as ring])
|
||||||
|
(require '[reitit.core :as r])
|
||||||
|
|
||||||
(defn my-expand [registry]
|
(defn my-expand [registry]
|
||||||
(fn [data opts]
|
(fn [data opts]
|
||||||
(or (if (keyword? data)
|
(if (keyword? data)
|
||||||
(some-> data
|
(some-> data
|
||||||
registry
|
registry
|
||||||
(r/expand opts)
|
(r/expand opts)
|
||||||
(assoc :name data)))
|
(assoc :name data))
|
||||||
(r/expand data opts))))
|
(r/expand data opts))))
|
||||||
|
|
||||||
;; the handler functions
|
;; the handler functions
|
||||||
(defn get-kikka [_] {:status 200, :body "get"})
|
(defn get-kikka [_] {:status 200, :body "get"})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue