Path-based routing is done using the reitit.core/match-by-path function. It takes the router and path as arguments and returns one of the following:
nil, no matchPartialMatch, path matched, missing path-parameters (only in reverse-routing)Match, an exact matchGiven a router:
(require '[reitit.core :as r])
(def router
  (r/router
    ["/api"
     ["/ping" ::ping]
     ["/user/:id" ::user]]))
No match returns nil:
(r/match-by-path router "/hello")
; nil
Match provides the route information:
(r/match-by-path router "/api/user/1")
; #Match{:template "/api/user/:id"
;        :data {:name :user/user}
;        :path "/api/user/1"
;        :result nil
;        :path-params {:id "1"}}
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |