Web framework in Clojure

This weekend I made a small web framework in Clojure. It was written in less than 4 hours, is less than 100 lines of code, and it doesn't do much. Here's the code for it.

The framework uses Ring to process requests and return responses. Ring represents HTTP requests and responses as native Clojure data structures, more specifically as maps.

The entry point is `app` (defined in `project.clj`) which takes a request and spits out a response. Here's what the framework does:

  1. Listen to HTTP traffic on port 3000 (with the help of ring.adapter.jetty)
  2. Safely serve static files in nested directories
  3. Connects Clojure functions to routes (routes as data!)
  4. Deals with one implicit argument for urls of format "/resource/:id" (for example: /users/foo)
  5. Deal with GET and POST requests (with the help of ring.middleware.params for putting form params in a :params key)

Here's what it doesn't do:

  1. Everything else.
  2. Use  no dependencies (wrap-params and run-jetty specifically).

That's all. Full code on Github: https://github.com/oskarth/webframework