Introducing playnice

August 20, 2012

Introduction

Today I am happy to announce playnice, a Clojure library of tools to help build HTTP standards compliant servers.

Existing libraries for developing web services focus mainly on ease. They try to make it easy to get started. They implement a naive, yet functional, version of the HTTP spec. It is basically the simplified understanding of HTTP that we all think in. A client makes requests to URLs, and the server responds with either an error or content.

But the HTTP spec is more complete than merely matching URLs and methods. There are many error classes defined in the spec and much functionality dealing with the meta-level of the capabilities of the server itself. In addition, there are many de facto standards and workarounds that should be baked into the server.

Philosophy

  1. Make it easier to serve HTTP standard responses without confounding HTTP logic with business logic.
  2. Make it easier for limited or non-standard clients to access resources.
  3. As much as possible separate orthogonal functionality into composable chunks.

playnice was named because it plays nice with others. The Web is a wide world, and there are lots of clients out there. You should follow the spec as closely as possible, but accept that not all clients are so strict. Also, there is a variety of input and output formats. You should play nice with them, if you can. playnice is a library to help Clojure programs play nice with the rest of the web.

playnice Opinions

Status

playnice is still in early development, but it already contains the following components:

Please check out playnice if you need an HTTP compliant web server.