Skip to content

Instantly share code, notes, and snippets.

@jaen

jaen/1-works.clj Secret

Created January 10, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaen/1e69cf7ec23adb350351 to your computer and use it in GitHub Desktop.
Save jaen/1e69cf7ec23adb350351 to your computer and use it in GitHub Desktop.
(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))
(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