             [compojure.route :as route]
             [ring.middleware.format-response :refer [wrap-clojure-response]]))
 
-(defn something-to-say []
-  (pr-str (edn/read-string (slurp "server-resources/things-to-say.edn"))))
+;; Load/Save world state
 
 (defn load-world []
   (with-open [in (java.io.PushbackReader. (reader "server-resources/world.edn"))]

    (spit "server-resources/world.edn" writer)
    "Saved"))

(defn get-resource
  [kind type encoding id]
  (let [r (str id "." type)

      (slurp f))))


;; Conversation resources

(defn something-to-say []
  (pr-str (edn/read-string (slurp "server-resources/things-to-say.edn"))))


;; Routes

(defroutes app-routes
  ; load/save world state
  (GET "/world" [] (load-world))
  (POST "/save-world" [world] (save-world world))
  
  ; media resources
  (GET "/:kind/:type/:id" [kind type encoding id] (get-resource kind type nil id))
  (GET "/:kind/:type/:encoding/:id" [kind type encoding id] (get-resource kind type encoding id))
  
  ; conversation resources
  (GET "/something-to-say" [] (something-to-say))
  
  ; default routes
  (route/resources "/")
  (route/not-found "Not Found"))

