If I use "(constantly...)", I get the following exception:
Exception: java.lang.IllegalArgumentException: No implementation of method: :match-by-path of protocol: #'reitit.core/Router found for class: clojure.core$constantly$fn__5740
1) use `:update-paths` to handle data in certain (loose) paths differently
- accumulate schemas in all relevant routers into vector
- we do not know the coercion here (ring/http have special handling of data, e.g. http-methods)
2) run coercion compiler for the model to merge the effective model
- schema + malli = should work ok, spec = best effort
3) publish final schemas into compiled route data
I wondered how one would wrap a ring handler that can be recreated at runtime without restarting the server. @ikitommi suggested to use the recently added `reloading-ring-handler` as a starting point.
I propose a small example here that illustrates the pattern.
The previous example only worked by accident (because there was an even number of map keys with conditional values).
{:get #?(:clj 1), :post #?(:clj 2)} gets read as {:get :post} in a non-clj context. The splicing reader conditional or a :cljs (or :default) value is needed to have the code work as intended. Here we change the docs to use the splicing version, as that is (imho) more beautiful than adding another branch.