Skip to content

Instantly share code, notes, and snippets.

@rgm
Last active Feb 19, 2020
Embed
What would you like to do?
(defn my-regular-handler
[req]
{:status 200 :headers {} :body []})
(defn my-resource-handler
[datasource req]
(let [foo (do-something-with-datasource datasource req)]
{:status 200 :headers {} :body foo}))
(defn make-top-level-handler
[datasource]
(reitit.ring/ring-handler
(reitit.ring/router
[["/" {:get {:handler my-regular-handler}}]
["/get-thing" {:get {:handler (partial my-resource-handler datasource)}}]])
(reitit.ring/routes
(reitit.ring/create-resource-handler {:path "/"})
(reitit.ring/create-default-handler))
{:middleware [,,,]}))
(defmethod ig/init-key ::app
[_ {:keys [datasource]}]
(make-top-level-handler datasource))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment