Created
February 10, 2020 07:28
-
-
Save slipset/c405bbb27f77eb5215eca4a365eb359a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(ns foo.core | |
(:require [ring.adapter.jetty :as jetty])) | |
(defn add-connection-middleware [handler uri] | |
(fn [req] | |
(let [connection (mg/connect-via-uri uri)] | |
(handler (assoc req :connection connection))))) | |
(defn handler [{:key [connection] :as request}] | |
{:status 200 | |
:headers {"Content-Type" "text/html"} | |
:body (str "Hello World" connection)}) | |
(jetty/run-jetty | |
(add-connection-middleware handler (config-keys :mongoURI)) | |
{:port 3000}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment