File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 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/example -handler
7+ :ring {:handler project1.core/route -handler
88 :init project1.core/on-init
99 :port 4001
1010 :destroy project1.core/on-destroy}
Original file line number Diff line number Diff line change 1- (ns project1.core )
1+ (ns project1.core
2+ (:require [project1.handlers :as handlers]))
23
34(defn example-handler [request]
45 {:headers {" Location" " http://github.com/ring-clojure/ring"
1617 " I don't do a whole lot."
1718 [x]
1819 (println x " Hello, World!" ))
20+
21+ (defn test1-handler [request]
22+ {:body " test1" })
23+
24+ (defn test2-handler [request]
25+ {:status 301 :headers {" Location" " http://github.com/ring-clojure" }})
26+
27+ (defn route-handler [request]
28+ (condp = (:uri request)
29+ " /test1" (test1-handler request)
30+ " /test2" (test2-handler request)
31+ " /test3" (handlers/handler3 request)
32+ nil ))
Original file line number Diff line number Diff line change 1+ (ns project1.handlers )
2+
3+ (defn handler3 [request]
4+ {:body " this is project1.handlers/handler3" })
5+
You can’t perform that action at this time.
0 commit comments