                       :bookmark/id id})})
   (catch Exception e (errorf "Error %s" (.toString e)))))
 
-(defn put-bookmark
-  "Upsert a bookmark in the database for an HTTP request."
+(defn put-bookmark "Upsert a bookmark in the database for an HTTP request."
   [id params & [status]]
   (try
     (infof "put-bookmark %s %s" id params)

      {:status (or status 200)})
  (catch Exception e (errorf "Error %s" (.toString e)))))

(defn delete-bookmark
  "Retract a bookmark in the database."
  [id & [status]]
  (try
    (infof "delete-bookmark %s" id)

    (catch Exception e (errorf "Error %s" (.toString e)))))

(defroutes routes
  ;; Views
  (GET "/" [] loading-page)
  (GET "/add" [] loading-page)
  (GET "/about" [] loading-page)
  (GET "/cards" [] cards-page)
  (GET "/select" [] loading-page)
  (GET "/search" [] loading-page)

  ;; API
  (GET "/api/bookmarks" {params :params} [] (get-bookmarks params))
  (GET "/api/bookmarks/:id" {id :id params :params} [] (get-bookmark id params))
  (POST "/api/bookmarks" {params :edn-params} (post-bookmark params))
  (PUT "/api/bookmarks/:id" {id :id params :edn-params} [] (put-bookmark id params))
  (DELETE "/api/bookmarks/:id" [id] (delete-bookmark id))

  (resources "/")
  (not-found "Not Found"))

(def app
  (-> #'routes
