Fork me on GitHub
#reitit
<
2020-08-28
>
iamyemeth13:08:20

Hey everyone, is there is simple way to break a circular dependency between handlers and routers e.g. handler -> match-by-name -> ring/router -> handler?

iamyemeth13:08:27

In a handler that returns hiccup, I’d like to use match-by-name to retrieve a url path without adding a circular dependency

ikitommi14:08:56

@occamin the ring-router is injected into request:

(defn handler [request]
  (let [router (:reitit.ring/router request)]
     ...))

iamyemeth14:08:36

that certainly simplifies things

ikitommi14:08:47

(you can disable the injection using router options, has a tiny runtime perf penalty of assoc;))

iamyemeth14:08:46

and in general for all the great work you guys are doing at metosin

👍 3
iamyemeth14:08:57

loving malli as well