reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
thelittlesipper 2020-04-24T18:47:38.183300Z

I see that the reitit frontend router accepts multiple controllers per route, but I can't find an example that uses multiple controllers (per route). Is this how one would go about it?

[{:start start-fn :stop stop-fn} 
{:start start-fn-2 :stop stop-fn-2}]
If so, what's the order of operations? Does start-fn always begin before start-fn-2? Does it work similarly to nested-controllers?

2020-04-24T19:25:01.187Z

I generally do something like

(def require-auth-controller {:start (fn [] (require-auth))})
(def load-data-controller {:start (fn [] (load-data]))})
and then do [require-auth-controller load-data-controller]. Based on putting in some println statements, it seems that the start functions run in the order they are given (so require-auth-controller followed by load-data-controller in the example), and I think I remember reading that the :stop functions run in the reverse order

1
thelittlesipper 2020-04-24T19:37:52.187300Z

thank ye!

👍 1