Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created July 9, 2010 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save swannodette/469930 to your computer and use it in GitHub Desktop.
Save swannodette/469930 to your computer and use it in GitHub Desktop.
(ns second-post.postgres
(:use aleph)
(:require [clojure.contrib.sql :as sql]))
(def db {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "dummy"
:user "postgres"})
(defn insert-foo [val]
(sql/insert-values :foo [:bar] [val]))
(defn save [request]
(future
(sql/with-connection db (insert-foo "test"))
(respond! request
{:status 200
:headers {"Content-Type" "text/html"}
:body "Saved!"})))
(run-aleph save {:port 8080})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment