Skip to content

Instantly share code, notes, and snippets.

@xvrdm
Last active December 16, 2015 11:08
Show Gist options
  • Save xvrdm/91b3f6c4faf248348e0d to your computer and use it in GitHub Desktop.
Save xvrdm/91b3f6c4faf248348e0d to your computer and use it in GitHub Desktop.
(ns proj.core)

(defn test1-handler [request]
  {:body (str "Test1: " request)})

(defn test2-handler [request]
  {:body (str "Test2: " request)})

(defn route-handler [request]
  (condp = (:uri request)
    "/test_url_1" (test1-handler request)
    "/test_url_2" (test2-handler request)
    nil))

(defn simple-log-middleware [handler]
  (fn [request]
    (println (str "Request path: " (:uri request)))
    (handler request)))

(def full-handler
  (-> route-handler
    simple-log-middleware))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment