Webjure, a web programming framework for Clojure
Clojure JavaScript
Switch branches/tags
Nothing to show
Clone or download
Tatu Tarvainen
Tatu Tarvainen Some CRUD improvements.
Latest commit 635f3cf Nov 8, 2011
Permalink
Failed to load latest commit information.
demos CPT supports dynamic attributes May 20, 2011
webjure Some CRUD improvements. Nov 8, 2011
.classpath
.gitignore Inspired by MVC mini profiler and GAE mini profiler, add a similar fe… Jun 28, 2011
.project Made Shell work better. Jan 24, 2008
LICENSE Update year in LICENSE and add changelog entry about Clojure 1.0.0. May 12, 2009
README.markdown Merge conflict. Sep 3, 2010
changes.txt Update year in LICENSE and add changelog entry about Clojure 1.0.0. May 12, 2009
pom.xml CPT supports dynamic attributes May 20, 2011

README.markdown

Webjure, a web programming framework for Clojure

Overview

Webjure is a simple web framework for Clojure. It provides basic routing, request and response functionality on top of Java servlets and then gets out of your way.

The defh macro can be used for more automagic behaviour when defining handlers. It can be used to automatically read and parse input parameters (both parts of the URL path and GET/POST params). The defh can also automatically send the response as HTML or JSON.

Webjure also provides Clojure Page Templates (see webjure.cpt namespace) can be used for dynamic HTML templates similar to ZPT/JPT. The templates are compiled to bytecode for good performance.

Hello world

A hello world in Webjure is very simple:

(ns my-hello-world
    (:refer-clojure)
    (:use webjure))

(defh "/hello" [] {:output :html}
   `(:html
      (:head (:title "Hello world from Webjure"))
      (:body
       "Hello world!")))

Wiki

For a slightly more complex example, see in-memory wiki.

Installation

To install, you will need Apache Maven 2.

Run "mvn install" in the main directory.

Running

After installation is done, you can depend on the webjure jar in your own web projects (or just copy the .jar from the target directory). To check out the demos, go to the "demos" subdirectory and run "mvn jetty:run" and point your browser to http://localhost:8080/webjure-demos/index.

SLIME users: To hack on the demos, first start swank by going to http://localhost:8080/webjure-demos/start-swank?port=4005 and then use slime-connect from Emacs.