-
-
Save jaen/1e69cf7ec23adb350351 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 handlers | |
{:index index-handler | |
:public public-resource-handler}) | |
(defn ring-routes [routes] | |
; basically a slightly modified version of https://github.com/juxt/bidi/blob/bidi-1.10.4/src/bidi/bidi.clj#L297-310 | |
; so that it closed over `handlers` to choose handler by a keyword routes returned | |
) | |
(defn make-handler [] | |
(-> (ring-routes routes) | |
reload/wrap-reload)) |
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 handlers | |
{:index index-handler | |
:public public-resource-handler}) | |
(defn ring-routes [routes handler-fns] | |
; like above, but modified to use handlers passed as a function argument | |
) | |
(defn make-handler [] | |
(-> (ring-routes routes handlers) | |
reload/wrap-reload)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment