-
-
Save mefesto/ca2c6bb1480411531a13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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