A library to help you serve HTTP standard responses and be lenient with HTTP requests.
- Make it easier to serve HTTP standard responses without confounding HTTP logic with business logic.
- Make it easier for limited or non-standard clients to access resources.
- As much as possible separate orthogonal functionality into composable chunks.
Add this to your dependencies:
[playnice "0.0.4"]
Then you can define a simple server like this.
(ns my.namespace
(:require [playnice.dispatch :as dis])
(:require [ring.adapter.jetty :as jetty]))
(def routes (-> nil
(dis/dassoc "/" :get (constantly "Home page!"))
(dis/dassoc "/:greeting/:greetee" :get #(str (:greeting %) ", " (:greetee %) "!"))))
(defn app [req] (dis/dispatch routes req))
(jetty/run-jetty app 8080)
Please use it and send your patches. I'd love to hear your feedback. Just create an issue in github. https://github.com/ericnormand/playnice
Copyright (C) 2012 FIXME
Distributed under the Eclipse Public License, the same as Clojure.