Skip to content

Instantly share code, notes, and snippets.

@mefesto
Created January 21, 2011 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mefesto/ca2c6bb1480411531a13 to your computer and use it in GitHub Desktop.
Save mefesto/ca2c6bb1480411531a13 to your computer and use it in GitHub Desktop.
;; wrappers
(defn wrap-connection [handler]
(fn [request]
(sql/with-connection config/dbspec
(handler request))))
;; handlers
(defn get-profile [request]
(let [params (:params request) id (params "id")]
(profile/find-by-id id)))
;; combine it all: this would actually use moustache or some other routing
(def app
(-> get-profile
wrap-params
wrap-db-connection))
;; start app
(run-jetty app {:port 8080})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment