reitit/doc/basics/path_based_routing.md
2017-10-29 09:29:06 +02:00

548 B

Path-based routing

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 match
  • PartialMatch, path matched, missing path-parameters (only in reverse-routing)
  • Match, exact match
(r/match-by-path router "/hello")
; nil
(r/match-by-path router "/api/user/1")
; #Match{:template "/api/user/:id"
;        :meta {:name :user/user}
;        :path "/api/user/1"
;        :result nil
;        :params {:id "1"}}