reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
_kontrarian 2020-08-28T13:52:20.045800Z

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?

_kontrarian 2020-08-28T13:53:27.046700Z

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

ikitommi 2020-08-28T14:04:56.048700Z

@occamin the ring-router is injected into request:

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

_kontrarian 2020-08-28T14:05:27.049100Z

ah perfect

_kontrarian 2020-08-28T14:05:36.049400Z

that certainly simplifies things

ikitommi 2020-08-28T14:05:47.049700Z

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

_kontrarian 2020-08-28T14:06:33.050100Z

many thanks

_kontrarian 2020-08-28T14:06:46.050400Z

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

šŸ‘ 1
_kontrarian 2020-08-28T14:06:57.050700Z

loving malli as well