Fork me on GitHub
#reitit
<
2021-10-19
>
danielgrosse21:10:12

I want to replace an rpc styled api with reitit. Currently all requests are made via POST and a query param e.g. localhost:3000/?action=foo . Can I set up my routes to cover each option of the action param in one specific route per action, so I'm able to define coercion parameters? Currently my setup doesn't match the route.

["/" 
  ["?action=" {:parameters {:query {:id s/Int}}}
    ["foo" {:post {:parameters {:form {:x s/Int }}
                   :handler ::foo }]]]

danielgrosse07:10:39

The request has the path as query-string. So ist it possible to match on the query string?

Apple13:10:08

i feel ?action is not part of the url per se.

Apple13:10:37

try to move the config details to under "/"

danielgrosse18:10:39

I also have this solution, but its not possible to create schema definition, as a single function is handling all requests.