Fork me on GitHub
#reitit
<
2019-04-26
>
conan16:04:54

i want to do reverse routing inside a ring handler, but in my handler function the router is (necessarily) not yet defined because the routes haven't been compiled yet. this example: https://metosin.github.io/reitit/ring/reverse_routing.html shows the problem, the router in there has not been defined. I've tried using declare to resolve this mutual dependency but it breaks my use of mount. What's a good pattern for this?

ikitommi17:04:39

@conan The router is injected into the request and (:reitit.ring/router request) should summon it out.

conan17:04:45

Ah! Yes that’s what I need, thanks. Have a great weekend

joshkh18:04:07

i'm a little stuck on coercion using reitit.coercion.spec. using schema works fine:

{:name       :view/home
 :coercion   reitit.coercion.schema/coercion
 :parameters {:path {:id s/Uuid}}}
how might i go about using spec instead to do the same? i checked in the tests but they all seem to be schema based 🙂

joshkh18:04:37

ah jeez this actually worked, i just needed to clear my cache:

{:name       :view/home
 :coercion   reitit.coercion.spec/coercion
 :parameters {:path {:id uuid?}}}

👍 8