Skip to content

Instantly share code, notes, and snippets.

@luxbock
Created July 10, 2014 13:28
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 luxbock/945c8f116c5e39d63967 to your computer and use it in GitHub Desktop.
Save luxbock/945c8f116c5e39d63967 to your computer and use it in GitHub Desktop.
(defn wrap-println [handler]
(fn [req]
(println "Got req:" req)
(handler req)))
(defroutes server
(->
(routes
(GET "/" req (#'resource-response "index.html" {:root "public"}))
(GET "/overview" [] (#'generate-response (pool-status-over-time)))
(GET "/equity" [] (#'generate-response (equity-over-time)))
(GET "/dates" [] (#'generate-response (vec (t/dates-played))))
(r/resources "/" {:root "public"})
(r/not-found "<h1>Page not found</h1>"))
handler/site
wrap-println
(cors/wrap-cors
:access-control-allow-origin #".+"
:access-control-allow-methods [:get]
:access-control-allow-headers ["Origin" "X-Requested-With" "Content-Type" "Accept"]
:access-control-allow-credentials "true")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment