Skip to content

Instantly share code, notes, and snippets.

@yochannah
Forked from joshkh/formatted.clj
Created March 22, 2017 16:46
Show Gist options
  • Save yochannah/f35f128e61b37632a4c79d079d4fa8fc to your computer and use it in GitHub Desktop.
Save yochannah/f35f128e61b37632a4c79d079d4fa8fc to your computer and use it in GitHub Desktop.
(ns redgenes.routes
(:require [compojure.core :refer [GET POST defroutes context ANY]]
[compojure.route :refer [resources]]
[hiccup.page :refer [include-js include-css html5]]
[redgenes.api.modelcount :refer [modelcount modelcount-children cache cacheall]]
[redgenes.index :as index]
[ring.util.response :refer [response resource-response]]))
(defroutes routes
(GET "/" []
(index/index))
(resources "/")
(GET "/worker" [worker]
(assoc
(response
(slurp "./resources/public/js/compiled/worker.js"))
:status 200
:headers {"content-type" "text/javascript"}))
(GET "/version" [] (response {:version "0.1.0"}))
(context "/api/model/count" [paths]
(GET "/cache" [mine] (cache mine)
(response {:loading (str "We're caching counts for " mine "! Well done.")}))
(GET "/cacheall" [] (cacheall)
(response {:loading "We're caching counts for all mines! Please wait."}))
(GET "/children" [path mine]
(response (modelcount-children path mine)))
(POST "/" [paths mine]
(response (modelcount paths mine)))
(GET "/" [paths mine]
(response (modelcount paths mine)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment