This is the start of a new series of episodes about backend development from the
ground up, and the first point of call, the foundation of any Clojure web app,
Ring is based on a simple but powerful idea, borrowed from Ruby’s Rack and
Python’s WSGI. If we can agree on a standard way to represent HTTP requests and
HTTP responses, then web servers, web apps, middleware, and other tooling that
follows this standard will just effortlessly click together, like legos. This
standard is embodied in the Ring specification.
HTTP is a simple text based protocol, the client, the so-called “user agent”
opens a connection to the server and sends a request that looks like this. I’m
using an Emacs package called HTTP Twiddle, so I can send this request and see
the server’s response.
The first line is the “Request Line”, it has three parts: the HTTP “method”, the
resource path, and the HTTP version. In this case we want to GET the resource at
the server root (“/”).
Following the request line are one or more headers. I’ve included a few common