Created
September 9, 2016 16:03
-
-
Save christianromney/651fd40879935de4c6f351cd54b882a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn show-routes | |
"Prints the application's route table" | |
[] | |
(print-routes routes)) | |
(defn named-route | |
"Finds a route by name" | |
[route-name] | |
(->> routes | |
(filter #(= route-name (:route-name %))) | |
first)) | |
(defn recognize-route | |
"Tries to match the verb and path to a route" | |
[verb path] | |
(route/try-routing-for routes :prefix-tree path verb)) | |
(defn url-for | |
"" | |
[route-name & options] | |
(let [router (route/url-for-routes | |
routes | |
:scheme "http" | |
:host "localhost" | |
:port 8080)] | |
(apply router route-name options))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment