Shared routes in reitit

I imagine that if I share clj and cljs reitit routes, I can centralize not only the routing but also parameter specification and coercion. But the examples given at only share the route paths between clj and cljs, there are no example of sharing :parameters or :responses keys. I would prefer without reader conditionals, so that the routes are in one ns, and clj and cljs handling of the routes are in separate namespaces.

How would one for example share these reitit example routes between clj and cljs? Found at

(def app
       ["/math" {:get {:parameters {:query {:x int?, :y int?}}
                       :responses {200 {:body {:total pos-int?}}}
                       :handler (fn [{{{:keys [x y]} :query} :parameters}]
                                  {:status 200
                                   :body {:total (+ x y)}})}}]]
      ;; router data effecting all routes
      {:data {:coercion reitit.coercion.spec/coercion
              :middleware [rrc/coerce-exceptions-middleware

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.