 (defroutes routes
   (resources "/")
   (resources "/react" {:root "react"})
+
   (GET "/" [_] (post-form))
-  (POST "/" [code] (show-code code))
-  (GET "/*" req (page)))
+
+  (GET  "/posts" [_] (show-posts))
+  (POST "/posts" [code] (post-code code))
+
+  (GET "/posts/:id" [id] (show-code id))
+
+  #_(GET "/*" req (page)))
 
 (def http-handler
   (if is-dev?

      body]
     (page/include-js "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js")]))

(defn post-form []
  (page-layout
    "Post to Screen"
    [:h1 "Post to Screen"]
    (form/form-to {:role "form"}
      [:post "/"]
      [:div.form-group
       (form/text-area {:class "form-control" :rows 20} "code")]
      (form/submit-button {:class "btn btn-primary"} "Post code"))))

(defn show-code [code]
  (code-layout
    "Posted code"
    [:pre
     [:code (util/escape-html code)]]))

(deftemplate page
  (io/resource "index.html") [] [:body] (if is-dev? inject-devmode-html identity))

            [ring.adapter.jetty :refer [run-jetty]]
            [hiccup.page :as page]
            [hiccup.form :as form]
            [hiccup.util :as util]
            [ring.util.response :refer [redirect]]))

; State

(def posts (ref {}))
(def nextId (ref 1))

; Post form

(defn page-layout [title & body]
  (page/html5
