         (map display-post (select-posts))]
       [:a {:href "/post"} "New Post"]
       [:p "Drag the bookmarklet: "
-        [:a {:href bookmarklet} "Read later"]])))      
+        [:a {:href bookmarklet} "Read later"]])))
 
 (defn new-post [location title]
   (insert-post location title)

      [:input {:type "text" :name "t"}]
      [:br]
      (submit-button "save"))))
  
(defroutes instapapure-app
   (GET "/public/*"
     (or (serve-file (params :*)) :next))
   (GET "/" 
       (show-posts))
   (GET "/posts" 
     (show-posts))
   (GET "/post" 
      (create-post))
   (POST "/post" 
      (new-post (:l params) (:t params)))
   (ANY "*" 
     (page-not-found)))

(run-server {:port 8080}
  "/*" (servlet instapapure-app))

(defn now [] (java.sql.Timestamp. (.getTime (java.util.Date.))))

(defn create-instapapure-tables []
  (create-table :posts
    [:id :int "IDENTITY" "PRIMARY KEY"]
    [:location :varchar "NOT NULL"]
    [:title :varchar "NOT NULL"]
    [:created_at :datetime]))

;; we put the table creation in a try.
;; All calls after the 1st one will fail because the table is already there
(try
  (with-connection db (create-instapapure-tables))
  (catch Exception _))

(defn insert-post [location title]
  (with-connection db
    (transaction
      (insert-values :posts
        [:location :title :created_at]
        [ location   title  (now)]))))

(defn select-posts []
  (with-connection db
    (with-query-results res ["select * from posts"] (doall res))))
