Changes for ring.middleware.params/wrap-params

zkim on Sun, 26 Sep 2010
;; This example adds support for parameters to a Ring handler:

(use 'ring.middleware.params
     'ring.adapter.jetty)

(defn handler [{params :params}]
  {:status  200
   :headers {"Content-Type" "text/plain"}
   :body    (str "Hello " (params "name"))})

(def app
  (wrap-params handler))

user=> (run-jetty app {:port 8080})


;; If you run this, then visit  you will see a message saying "Hello Bob"
weavejester on Sat, 10 Jul 2010
This example adds support for parameters to a Ring handler:

(use 'ring.middleware.params
     'ring.adapter.jetty)

(defn handler [{params :params}]
  {:status  200
   :headers {"Content-Type" "text/plain"}
   :body    (str "Hello " (params "name"))})

(def app
  (wrap-params handler))

(run-jetty app {:port 8080})


If you run this, then visit <http://localhost:8080/?name=bob> you will see a message saying "Hello Bob"
weavejester on Sat, 10 Jul 2010
This example adds support for parameters to a Ring handler:

(use 'ring.middleware.params
     'ring.adapter.jetty)

(defn handler [{params :params}]
  {:status  200
   :headers {"Content-Type" "text/plain"}
   :body    (str "Hello " (params "name"))})

(def app
  (wrap-params handler))

(run-jetty app {:port 8080})


If you run this, then visit <http://localhost:8080/?name=bob> you will see a message saying "Hello Bob"</http://localhost:8080/?name=bob>
weavejester on Sat, 10 Jul 2010
This example adds support for parameters to a Ring handler:


(use 'ring.middleware.params
     'ring.adapter.jetty)

(defn handler [{params :params}]
  {:status  200
   :headers {"Content-Type" "text/plain"}
   :body    (str "Hello " (params :name))})

(def app
  (wrap-params handler))

(run-jetty app {:port 8080})


If you run this, then visit <http://localhost:8080/?name=Bob> you will see a message saying "Hello Bob"