I want to build a website using Clojure...so: 1) which are the best libraries out there to do this at this time (summer 2011) 2) where are the best tutorials showing more than just a basic static "Hello World" webpage?
7 Answers
The key library to learn and understand is Ring. Ring is the basis for all of the web "frameworks" in the Clojure toolkit, the most well-known being Compojure, Moustache, and Conjure.
Per the Ring readme, Ring "abstracts HTTP to allow modular and concise webapps". Translation: Ring lets you deal with HTTP requests and responses as simple Clojure maps and allows you to apply "middlewares" (functions that do things to those request/response maps) to add extra functionality like session handling, URL parameter handling, cookie handling, etc.
If you don't understand Ring, you won't understand what the other libraries do for you.
At the most basic level, Compojure and Moustache provide conveniences on top of Ring, specifically route handling and easier application of middleware functions. Beyond that, Compojure comes packed with a lot, while Moustache is more minimal framework. Conjure is a more Rails-like, full-blown framework that handles web app development at a similar level of abstraction as Rails (pre-built MVC architecture, schema help, etc.).
For a good overview of all the libraries in the Clojure web space, see this graphic: http://www.glenstampoultzis.net/blog/wp-content/uploads/2010/10/web-layers7.png
There's a lot there. At this point, folks seem to be bringing smaller libraries together as needed to write web apps, instead of relying on one bulky "killer" web framework that tries to be all things to all people.
Comments
1) imho the best (the most mentioned and elaborated) is Compojure + Ring
2) tutorials: simple: "Getting Started with Ring and Compojure" http://rob-rowe.blogspot.com/2011/03/getting-started-with-ring-and-compojure.html
more complex: "Building a Social Media site" http://www.bestinclass.dk/index.clj/2011/01/building-a-social-media-site.html
Comments
Noir is a Clojure web framework that's been released recently.
2 Comments
Check out "A brief overview of the Clojure web stack", which is a wonderful guide to the current state of web-related Clojure libraries.
Comments
- Intro to Clojure is one the video tutorials
- http://blip.tv/clojure has some screen casts, which will be helpful for you
- Learn Clojure
- http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html