<html><body><div>Hi,<br><br>I'm currently learning racket, and started developing a web application.<br>When using dispatch-rules, my first thought was to create separate dispatch<br>rules and then call them from a top dispatch. Something like this:<br><br>(dispatch-rules<br>   (("admin") admin-dispatch)<br>   (("api") api-dispatch)<br>   ... other rules)<br><br>(define-values (admin-dispatch admin-url)<br>  ("" admin-index)<br>  ...)<br><br>(define-values (api-dispatch api-url)<br>  ("" api-index)<br>  ...)<br><br>If I understand correctly there's no simple direct way to do this. I managed to do it the<br>following way:<br><br>- defining the top level dispatch with string-arg's to catch all requests,<br>and wrapping the dispatch function to use only the first argument (the request)<br>(define-values (top-dispatch top-url)<br>  (dispatch-rules<br>    (("admin") (string-arg) ...)  (lambda args (admin-dispatch (first args))))))<br><br>- defining the other dispatch functions with the sub-path repeated<br>(define-values (admin-dispatch admin-url)<br>  (dispatch-rules<br>    (("admin" "posts") admin-posts)))<br><br>My questions:<br><br>- is there an existing way to create this kind of cascading or nested dispatch rules?<br>- is there a parameter matcher to match anything that I could use instead of<br>   (("path") (string-arg) ...)  (lambda args (path-dispatch (first args))))<br>or some better way to match everything starting with "path"?<br><br>If there is no way I'm thinking of creating a macro to simplify, so that I don't need<br>wrapping the dispatch functions, specifying parameters and then discarding and so on.<br><br>Thanks,<br><br>AndrĂ©<br data-mce-bogus="1"></div></body></html>