reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
juri 2021-05-16T12:11:03.260900Z

Hi. I'm wondering if it's possible to have both GET and POST for the same route with reitit? When I try the following I get an error

2021-05-16T12:22:10.265Z

Sure, you just have to nest it instead of listing it as a series of empty routes:

{"/polls"
  {:middleware [middleware/wrap-csrf middleware/wrap-formats]
   :name "Polls"
   :get {:handler #'my/get-handler}
   :post {:handler #'my/post-handler}}
Caveat: that’s my early morning, pre-coffee, top-of-my-head code, I think it’s correct but no guarantees. That’s the general idea tho.

juri 2021-05-16T13:17:48.266Z

Ah now I see, thanks! I tried something earlier but it didn't work. But this worked