            (apply compojure/routes router)
            (concat extra-middleware
                    [keyword-params/wrap-keyword-params
-                    params/wrap-params]))
+                    params/wrap-params
+                    logging]))
    {:port port}))

           ;; if :status is defined, assume this is a response and short circuit the normal handler
           (if (:status processed-request#)
             processed-request#
             (d/chain (handler# processed-request#) #(response-fn# request# %))))))))

(defn start!
  [router & {:keys [port extra-middleware]}]

  [-name args & forms]
  `(defn ~-name
     ~args
     (-> (let [~args [(-body-to-string (first ~args))]]
           ~@forms)
       (try (catch Throwable ex#
              (timbre/error ex# "handler" '~-name "failed with" (first ~args))
              (throw ex#)))
       a/go
       s/->source
       s/take!)))

(defmacro defmiddleware
  [name request-form response-form]
