   "Simplistic JSON API for a Job board"
   (:require [org.httpkit.server   :as server]
             [ring.middleware.json :as json]
-            [compojure.handler    :as handler]
             [compojure.route      :as route]
             [compojure.core       :refer [defroutes GET POST DELETE]]
             [ring.util.response   :refer [response redirect]])

(defn -main
  "Start the API"
  [& args]
  (server/run-server (mksite job-api) {:port 8080})
  nil)

  [id]
  (swap! db dissoc id))

(defroutes api-routes
  "Main router: 3 REST routes and resource handlers."

  (GET  "/jobs" []         (response @db))
  (POST "/jobs" req        (response (create! (:body req))))
  (DELETE "/jobs/:id" [id] (response (delete! id)))

  (GET  "/" []             (redirect "/index.html"))
  (route/resources         "/")
  (route/not-found         "<html><h2>404</h2></html>"))
