Fork me on GitHub
#reitit
<
2019-07-11
>
Ahmed Hassan10:07:55

Do reitit.frontend.controllers support calling other controllers from within a controller?

ikitommi10:07:07

@ahmed1hsn manually yes, just query the :start or :stop from a controller and invoke it. No helpers currently to auto-wire controllers together.

👍 4
ikitommi10:07:37

If Controllers were first-class like mw & interceptors (they should be), one could do this:

(def c1 {:start ...})
(def c2 {:start ...})
(def c3 {:start ...})
(def c12 [c1 c2])

(def routes ["/route" {:controllers [c12 c3]}])

👍 4
🎉 4
ikitommi11:07:38

Anyone interested in a PR for making that? Basically copying the expansion protocols from reitit.interceptor.

👍 4