Skip to content

Commit

Permalink
Fix README markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Meier committed Nov 4, 2009
1 parent 98603b4 commit 6ed3bac
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ Sample Code

A small example web application as in test.clj

(ns test
(:use compojure)
(:use compojure-rest))

(defn hello-resource []
(compojure-rest/make-handler {
:get (fn [req] (str "Hello " ((req :route-params {}) :who "unknown foreigner")))
:generate-etag (fn [req] ((req :route-params) :who))
:expires (constantly 10000) ; expire in 10 sec
:last-modified (constantly -10000) ; last modified 10 sec ago
:authorized? (fn [req] (not (= "tiger" ((req :route-params {}) :who))))
:allowed? (fn [req] (not (= "scott" ((req :route-params {}) :who))))
}))


(defroutes my-app
(ANY "/hello/:who" (hello-resource))
(ANY "/simple/" (compojure-rest/make-handler { :get (fn [req] "Simple") }))
(ANY "*" (page-not-found)))


(run-server {:port 8080}
"/*" (servlet my-app))
(ns test
(:use compojure)
(:use compojure-rest))
(defn hello-resource []
(compojure-rest/make-handler {
:get (fn [req] (str "Hello " ((req :route-params {}) :who "unknown foreigner")))
:generate-etag (fn [req] ((req :route-params) :who))
:expires (constantly 10000) ; expire in 10 sec
:last-modified (constantly -10000) ; last modified 10 sec ago
:authorized? (fn [req] (not (= "tiger" ((req :route-params {}) :who))))
:allowed? (fn [req] (not (= "scott" ((req :route-params {}) :who))))
}))
(defroutes my-app
(ANY "/hello/:who" (hello-resource))
(ANY "/simple/" (compojure-rest/make-handler { :get (fn [req] "Simple") }))
(ANY "*" (page-not-found)))
(run-server {:port 8080}
"/*" (servlet my-app))

Dependencies
------------
Expand Down

0 comments on commit 6ed3bac

Please sign in to comment.