Created
March 5, 2010 05:12
-
-
Save wilig/322462 to your computer and use it in GitHub Desktop.
This file contains 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
(def route-list (atom {})) | |
(defmacro with-name | |
[name route] | |
(swap! route-list assoc name (nth route 1)) | |
route) | |
;; Needs to get fancier to handle generating routes with parameters | |
(defn url-for | |
[route-name] | |
(route-name @route-list)) | |
;; Now we can... | |
(defroutes webauth-public | |
(with-name :login (GET "/login" (controller/login))) | |
(with-name :forgot (GET "/forgot-password" (controller/forgot-password))) | |
(with-name :signup (GET "/signup" (controller/signup))) | |
(with-name :activate (GET "/activate/:token" (controller/activate params)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's your mileage on this so far? Any reason I should look elsewhere for named routes?