This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-05
Channels
- # adventofcode (246)
- # aleph (5)
- # aws (7)
- # beginners (161)
- # boot (3)
- # calva (42)
- # cider (40)
- # clara (10)
- # cljdoc (7)
- # cljs-dev (40)
- # cljsrn (6)
- # clojure (170)
- # clojure-dev (8)
- # clojure-greece (2)
- # clojure-italy (15)
- # clojure-kc (2)
- # clojure-new-zealand (13)
- # clojure-nl (13)
- # clojure-russia (3)
- # clojure-spec (5)
- # clojure-uk (160)
- # clojurescript (72)
- # clojurex (1)
- # cursive (7)
- # data-science (9)
- # datascript (1)
- # datomic (120)
- # devcards (4)
- # emacs (18)
- # figwheel-main (10)
- # fulcro (34)
- # kaocha (3)
- # luminus (1)
- # lumo (6)
- # music (1)
- # nrepl (23)
- # off-topic (2)
- # pedestal (4)
- # re-frame (42)
- # reagent (36)
- # reitit (10)
- # ring-swagger (21)
- # shadow-cljs (124)
- # spacemacs (6)
- # tools-deps (14)
- # unrepl (3)
- # vim (2)
@arne-clojurians hi. Yes, that’s looks like bidi 😉 I think you can simplify the app with reitit as you can attach any meta-data to the routes.
In your case, here are some options on modelling with reitit:
(def routes
[["/" ::login]
;; flat routes, custom data
["/library"
{:protected? true
:name ::library
:events [[:api/request "get-library"]]}]
["/library/:kind"
{:name ::library-kind
:parameters {:path {:kind int?}}
:events [[:api/request "get-library-kind"]]}]]
;; nested routes & controllers
["/library-nested"
{:protected? true
:controllers [load-library-controller]}
[""
{:name ::library}]
["/:kind"
{:name ::library-kind
:parameters {:path {:kind int?}}
:controllers [load-kind-controller]}]])
e.g. flat-routes (as you have), but just with extra data, which is available on match. or nested routes where you can also nest the loads => going into /library-nested/kikka
would invoke :start
on both load-library-controller
& load-kind-controller
the frontend guides were updated few days ago, hopefully bit better now. there are example project on how to setup reitit too.
Is there a way to indicate that the same :summary
, :handler
, etc.. should be used for multiple HTTP methods?
@robert.mather.rmm yes, you can generate them. You can also put data to top-level route data, which gets merged to all endpoints.