- uri-match method uri routesprocedure
Matches a given HTTP method (which should be given as an upper-case symbol to comply with intarweb) and the uri's path (which must either be an uri-reference with an uri-path or a string representing a path) in routes (which must be a list of the format returned by make-routes) and returns a thunk which, when invoked, returns the body of the first matching route, #f otherwise. If the body is a procedure, it is applied to the possibly found capture groups of the matching route. Additionally, the first argument passed to that procedure is procedure which can be called to continue the matching process (see make-uri-matcher for an example use).
((uri-match 'GET "/foo/42" (make-routes `(((/ "foo" "(\\d+)") (GET ,(lambda (c n) (format "You got foo number ~A" n)))))))) => "You got foo number 42"