Skip to content

Instantly share code, notes, and snippets.

@christianromney
Created September 9, 2016 16:03
Show Gist options
  • Save christianromney/651fd40879935de4c6f351cd54b882a1 to your computer and use it in GitHub Desktop.
Save christianromney/651fd40879935de4c6f351cd54b882a1 to your computer and use it in GitHub Desktop.
(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