Skip to content

Commit 4c9f8d8

Browse files
committed
section 3 video 1
1 parent 42016ae commit 4c9f8d8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:license {:name "Eclipse Public License"
55
:url "http://www.eclipse.org/legal/epl-v10.html"}
66
:plugins [[lein-ring "0.8.7"]]
7-
:ring {:handler project1.core/wrapping-handler
7+
:ring {:handler project1.core/full-handler
88
:init project1.core/on-init
99
:port 4001
1010
:destroy project1.core/on-destroy}

src/project1/core.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
(ns project1.core
22
(:require [project1.handlers :as handlers]))
33

4+
(defn simple-log-middleware [handler]
5+
(fn [{:keys [uri] :as request}]
6+
(println "Request path:" uri)
7+
(handler request)))
8+
49
(defn example-handler [request]
510
{:headers {"Location" "http://github.com/ring-clojure/ring"
611
"Set-cookie" "test=1"}
@@ -39,3 +44,6 @@
3944
{:status 404 :body (str "Not found: " (:uri request))})
4045
(catch Throwable e
4146
{:status 500 :body (apply str (interpose "\n" (.getStackTrace e)))})))
47+
48+
(def full-handler
49+
(simple-log-middleware wrapping-handler))

0 commit comments

Comments
 (0)