Fork me on GitHub
#reitit
<
2020-08-27
>
wombawomba07:08:34

Is there a way to declare ‘wildcard’ routes, that match any method? I have a route that just routes requests to a CGI script and I’d like to avoid creating duplicate routes for every method the CGI script supports.

wegi07:08:11

Do you mean something along the lines of "/cgi/:some-method" ?

wombawomba07:08:38

No, I meant HTTP methods. I have a route on the form ["/cgi/*foo" {:get ..., :post ..., :put ..., :delete ..., :options ..., :patch ..., :head ...}] where every method works the exact same way (just passes the request along to the CGI script). I’d like to be able to do something like ["/cgi/*foo" {:* ...}] to avoid code duplication.

delaguardo07:08:53

["/cgi/*foo" {:handler ...}]
this will catch all the methods

wombawomba07:08:44

Perfect, thanks!