Skip to content

Commit

Permalink
Improved docstrings on compojure.handler functions
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Feb 2, 2011
1 parent 73a2eed commit 1fac7c2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/compojure/handler.clj
Expand Up @@ -7,22 +7,35 @@
cookies
session]))

(defn- with-opts
[routes middleware opts]
(defn- with-opts [routes middleware opts]
(if opts
(middleware routes opts)
(middleware routes)))

(defn api
"Create a handler suitable for a web API."
"Create a handler suitable for a web API. This adds the following
middleware to your routes:
- wrap-params
- wrap-nested-params
- wrap-keyword-params"
[routes]
(-> routes
wrap-keyword-params
wrap-nested-params
wrap-params))

(defn site
"Create a handler suitable for a standard website."
"Create a handler suitable for a standard website. This adds the
following middleware to your routes:
- wrap-session
- wrap-cookies
- wrap-multipart-params
- wrap-params
- wrap-nested-params
- wrap-keyword-params
A map of options may also be provided. These keys are provided:
:session - a map of session middleware options"
[routes & [opts]]
(-> (api routes)
(wrap-multipart-params)
Expand Down

0 comments on commit 1fac7c2

Please sign in to comment.