Fork me on GitHub
#reitit
<
2020-07-28
>
Dave Simmons05:07:15

(def router
  (reitit/router
   ["/"
    ["" {:conflicting true
         :name        :home
         :view        #'home-page
         :controllers [{:start (fn [_] (rf/dispatch [:page/init-home]))}]}]
    ["org"
     [""
      {:conflicting true
       :name        :org
       :view        #'home-page
       :controllers [{:start (fn [_] (js/console.log "/org"))}]}]

     ["/new"
      {:conflicting true
       :name        :org-new
       :view        #'home-page
       :controllers [{:start (fn [_] (js/console.log "/org/new called"))}]}]]]))

oly09:07:05

is there a way i can accept a json body in any format ? something like

:parameters {:body (s/keys)}

dharrigan10:07:12

If using malli, you could have any?, perhaps.

ikitommi10:07:44

any? should work with spec too

miikka10:07:43

We've deprecated the docs at https://metosin.github.io/reitit/ in favor of the docs at cljdoc. I tried to keep the images around as-is and set up redirects so that hopefully old links still work!

miikka10:07:32

(The docs were the same, there were just two copies hosted at different places)

dharrigan10:07:09

that's great - less confusing 🙂

oly10:07:21

cheers i will give any? a try 🙂

athomasoriginal21:07:04

I had a chance to work on this question further: https://clojurians.slack.com/archives/C7YF1SBT3/p1595698484361900 The solution I currently have is borrowed from https://github.com/metosin/reitit/blob/9729a7424ee024c6e6c995f236531dfb2f93ce66/examples/frontend-controllers/src/backend/server.clj#L6 where my router uses https://gist.github.com/athomasoriginal/14c6cfa1500bc1ab1a90a98b9d7217a0#file-reitit-backend-spa-cljs-L39. If this solution is fine, my question is now: Is the purpose of create-resource-handler not so much as a spa fallback + static resource shortcut, but just as a quick way to make static resources (example: public/css/* or public/cljs-out/* available without having to specify each route individually? :thinking_face: My original thought was that it would look for static files and if none found just return the public/index.html file.