Update shared routes doc

Added missing require.
Removed use of `or` and added the else branch to the `if` statement.
This commit is contained in:
Alex King 2019-03-05 12:00:29 +01:00 committed by GitHub
parent 19ae220d5f
commit 3f05328a68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,15 +53,16 @@ For the backend, we can use a custom-expander to expand the routes:
```clj
(require '[reitit.ring :as ring])
(require '[reitit.core :as r])
(defn my-expand [registry]
(fn [data opts]
(or (if (keyword? data)
(some-> data
registry
(r/expand opts)
(assoc :name data)))
(r/expand data opts))))
(if (keyword? data)
(some-> data
registry
(r/expand opts)
(assoc :name data))
(r/expand data opts))))
;; the handler functions
(defn get-kikka [_] {:status 200, :body "get"})