Skip to content

Commit

Permalink
Described Demo 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
danskarda committed Sep 29, 2012
1 parent 6afcad4 commit 1364839
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions demo/demo-2-compojure/README.md
@@ -1,25 +1,38 @@
# demo
# Demo 2

project.clj
-----------

For the second demo we included two libraries: hiccup and
compojure.
In our second demo we added two libraries to help us with Clojure
development web development

https://github.com/weavejester/hiccup
https://github.com/weavejester/compojure
* [Hiccup](https://github.com/weavejester/hiccup)
* [Compojure](https://github.com/weavejester/compojure)

For easier request handling we also added ring-core and
ring-devel. Both include definition of ring "middleware".
See [project.clj](project.clj) for changes.

Hiccup
------

Hiccup is a library for HTML rendering from Clojure data
structures
Hiccup library uses Clojure data types to express HTML structure.
HTML tree is expressed using vectors and list. Vectors start
with element keyword and are optionally followed with map
of attributes.

See [page.clj](src/demo/page.clj) for hello-world example.

Compojure
---------

Is a DSL (Domain Specific Language) for writing routing
information for Ring.
Compojure defines DSL (domain specific language) for request routing.
In [core.clj](src/demo/core.clj) we use it fullfil request GET /.
More complex examples will follow in Demo 3.

Middleware
----------

Function `jetty-handler` in [core.clj](src/demo/core.clj) shows how
you can extend basic jetty functionallity using middleware. `jetty-handler`
is now composed from four independent parts - our routing function (`main-route`),
then two functions for processing arguments and development utility which
wraps any exception and produces readable output both in browser and in RPEL.

0 comments on commit 1364839

Please sign in to comment.