Skip to content

Instantly share code, notes, and snippets.

@tcoupland
Created April 28, 2012 11:02
Show Gist options
  • Save tcoupland/2517996 to your computer and use it in GitHub Desktop.
Save tcoupland/2517996 to your computer and use it in GitHub Desktop.
Simple compojure handler with logging middleware
(ns compojur-learning.core
(:use compojure.core))
(defroutes handler
(GET "/" [] (println "middle") {:status 200}))
(defn logging [chain] (fn [req] (
(println "before")
(chain req)
(println "after"))))
(def app (-> handler logging))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment