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?
Yes, Clojure is great for web development. Here are the main reasons: JVM deployment options. Clojure can deploy anywhere Java can.
Clojure is an umbrella level project that hosts many additional libraries called Clojure contrib, which all exist under the Clojure organization on GitHub.
Luminus is a Clojure micro-framework based on a set of lightweight libraries. It aims to provide a robust, scalable, and easy to use platform. With Luminus you can focus on developing your app the way you want without any distractions.
There's a web framework called Compojure you might look at. I've never used it personally, but this blog (by a frequent stack overflow contributer) seemed to have been written using it.
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.
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
Noir is a Clojure web framework that's been released recently.
Check out "A brief overview of the Clojure web stack", which is a wonderful guide to the current state of web-related Clojure libraries.
I recently switched from
(+ Clojure ring compojure hickup google-app-engine)
to
(+ clojure ring compojure enlive heroku)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With