This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-06
Channels
- # aleph (1)
- # announcements (29)
- # babashka (39)
- # beginners (52)
- # cider (3)
- # cljsrn (19)
- # clojure (167)
- # clojure-europe (15)
- # clojure-nl (2)
- # clojure-uk (62)
- # clojurescript (13)
- # community-development (8)
- # cursive (5)
- # datomic (10)
- # introduce-yourself (1)
- # java (10)
- # jobs (12)
- # jobs-discuss (1)
- # kaocha (2)
- # lsp (6)
- # luminus (1)
- # malli (15)
- # meander (3)
- # music (1)
- # nrepl (2)
- # off-topic (91)
- # pathom (4)
- # reagent (21)
- # reitit (10)
- # sci (5)
- # shadow-cljs (17)
- # spacemacs (3)
- # sql (7)
- # tools-deps (40)
- # utah-clojurians (2)
- # xtdb (7)
I like the idea of having the routing table defined in a EDN file as mentioned here https://cljdoc.org/d/metosin/reitit/0.5.13/doc/ring/middleware-registry However, it seems that we would need a way to decouple between the routing and the functions that define the behaviour of the handler. Is it possible with ring-router?
I think currently not, ring-handler
doesn't take option to modify the match before taking the :handler
from the match. But I think you can go through the route tree yourself before giving routes to ring-handler.
https://github.com/metosin/reitit/blob/master/modules/reitit-ring/src/reitit/ring.cljc#L327
yeah. The current expand
takes the whole endpoint. There could be separate expand for handlers?
aha, compile-result
takes expand
option, but where is that passed in?
From router
. ring-router
docstring doesn't mention it directly, but says to look at ring.core/router
:
https://github.com/metosin/reitit/blob/master/modules/reitit-core/src/reitit/core.cljc#L357
That should be usable, but you need to go through over http methods yourself
I think expand is called for each method. So no need for.http-stuff, but everything under one method. See https://github.com/metosin/reitit/blob/master/modules/reitit-ring/src/reitit/ring.cljc#L25-L30
... would be easy to add another expander just for handler, but not sure if that's useful enough.
Oh, there is a guide for this already https://cljdoc.org/d/metosin/reitit/0.5.13/doc/advanced/shared-routes#using-custom-expander
Very nice!
Oh, there is a guide for this already https://cljdoc.org/d/metosin/reitit/0.5.13/doc/advanced/shared-routes#using-custom-expander