reitit

Eugen 2025-01-20T13:54:16.619099Z

hi, does reitit have some helper to build URL's for navigating (server side rendering) ? I am using this code to get the path for a route by name but I need to pass pagination params as query string:

(defn url-by-route-name
  ([router route-name]
   (url-by-route-name router route-name {}))
  ([router route-name path-params]
   (-> router
       (r/match-by-name route-name path-params)
       :path)))
How do you guys build the full URL in ring apps?

valtteri 2025-01-20T15:16:05.515969Z

There's match->path helper in reitit core. Documented here (near bottom) https://cljdoc.org/d/metosin/reitit/0.7.2/doc/basics/name-based-routing

Eugen 2025-01-20T15:38:50.117119Z

thanks, I missed that. I saw it in code but for some reason it was not obvious what it did

valtteri 2025-01-20T15:45:39.707419Z

No problem! Perhaps a good docstring could make that more obvious 🤔

👍 1