Fork me on GitHub
#reitit
<
2020-04-24
>
thelittlesipper18:04:38

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?

manutter5119:04:01

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

parens 4