   (:require [aleph.http                 :as http]
             [ring.util.codec            :as codec]
             [org.spootnik.cyanite.store :as store]
+            [org.spootnik.cyanite.path  :as path]
             [cheshire.core              :as json]
             [lamina.core                :refer [enqueue]]
             [clojure.string             :refer [lower-case]]

(defn start
  "Start the API, handling each request by parsing parameters and
   routes then handing over to the request processor"
  [{:keys [http store carbon] :as config}]
  (let [handler (fn [chan request]
                  (-> request
                      (assoc-params)
                      (assoc-route)
                      (wrap-process (:rollups carbon) chan store)))]
    (http/start-http-server handler http))
  nil)

(defn wrap-process
  "Process request, generating a JSON output for it, catch exception
   and yield a payload"
  [request rollups chan store index]
  (debug "got request: " request)
  (enqueue
   chan
