Permalink
Please sign in to comment.
Browse files
Removed example directory
A better place for examples would be linked from the wiki.
- Loading branch information...
Showing
with
0 additions
and 62 deletions.
- +0 −2 README.md
- +0 −16 example/hello_world.clj
- +0 −21 example/linted.clj
- BIN example/public/clojure.png
- +0 −23 example/wrapping.clj
2
README.md
16
example/hello_world.clj
| @@ -1,16 +0,0 @@ | ||
| -; A very simple Ring application. | ||
| - | ||
| -(ns ring.example.hello-world | ||
| - (:use ring.adapter.jetty) | ||
| - (:import java.util.Date java.text.SimpleDateFormat)) | ||
| - | ||
| -(defn app | ||
| - [req] | ||
| - {:status 200 | ||
| - :headers {"Content-Type" "text/html"} | ||
| - :body (str "<h3>Hello World from Ring</h3>" | ||
| - "<p>The current time is " | ||
| - (.format (SimpleDateFormat. "HH:mm:ss") (Date.)) | ||
| - ".</p>")}) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
21
example/linted.clj
| @@ -1,21 +0,0 @@ | ||
| -; An example of inserting the linter between each component to ensure | ||
| -; compliance to the Ring spec. | ||
| - | ||
| -(ns ring.example.linted | ||
| - (:use (ring.handler dump) | ||
| - (ring.middleware stacktrace file file-info reload lint) | ||
| - (ring.adapter jetty))) | ||
| - | ||
| -(def app | ||
| - (-> handle-dump | ||
| - wrap-lint | ||
| - wrap-stacktrace | ||
| - wrap-lint | ||
| - wrap-file-info | ||
| - wrap-lint | ||
| - (wrap-file "example/public") | ||
| - wrap-lint | ||
| - (wrap-reload '(ring.handler.dump)) | ||
| - wrap-lint)) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
BIN
example/public/clojure.png
Deleted file not rendered
23
example/wrapping.clj
| @@ -1,23 +0,0 @@ | ||
| -; A example of modular construction of Ring apps. | ||
| - | ||
| -(ns ring.example.wrapping | ||
| - (:use ring.handler.dump | ||
| - ring.middleware.stacktrace | ||
| - ring.middleware.file-info | ||
| - ring.middleware.file | ||
| - ring.adapter.jetty)) | ||
| - | ||
| -(defn wrap-error [app] | ||
| - (fn [req] | ||
| - (if (= "/error" (:uri req)) | ||
| - (throw (Exception. "Demonstrating ring.middleware.stacktrace")) | ||
| - (app req)))) | ||
| - | ||
| -(def app | ||
| - (-> handle-dump | ||
| - wrap-error | ||
| - (wrap-file "example/public") | ||
| - wrap-file-info | ||
| - wrap-stacktrace)) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
0 comments on commit
c8089a8