Skip to content

Instantly share code, notes, and snippets.

@mirrormatch
Created January 8, 2011 19:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mirrormatch/771083 to your computer and use it in GitHub Desktop.
Save mirrormatch/771083 to your computer and use it in GitHub Desktop.
(ns comp3.core
(:use compojure.core)
(:require [compojure.route :as route]
[ring.adapter.jetty :as jetty]))
(defn simple-logging-middleware [app]
(fn [req]
(println req)
(app req)))
(defroutes middleware-routes
(ANY "/" {} {:body "Hello Compojure!"})
(route/not-found "Page not found"))
(def middleware-app
(-> middleware-routes
simple-logging-middleware))
(defn start-server []
(future (jetty/run-jetty (var middleware-app) {:port 8081})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment