Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 68 lines (49 sloc) 1.63 kb
dce7105 first version
Tim Lopez authored
1 Gulliver
2 ========
3
4 A lightweight web development framework, building on top of
5 Clojure/Compojure. (Highly experimental and draft). Currently allows
6 template files with embedded Clojure.
7
8 Using Clojure Templates
9 -----------------------
10
11 There is a default template server defined that tries to load the file
12 against the current directory, and returns the executed template.
13
14 To set up a server, all that is required is::
15
16 (use 'gulliver)
17
18 (defserver web-server
19 {:port 8080}
20 "/*" (servlet gulliver/template-servlet))
21
22 (start web-server)
23
24 Details
25 -------
26
27 Each file is compiled into a single routine, render, which takes the
28 request. Every file has its own namespace; for example, if you have a
29 file /admin/edituser.clj, then the render routine would be
30 admin.edituser.clj/render.
31
32 Example
33 -------
34
35 An example::
36
37 <?
38 (import 'java.util.Date)
39 ?>
40
41 <html>
42 <body>
43 <h1>Delivered via Gulliver</h1>
44 <p>Expressions at work: <?= (+ 2 2) ?></p>
45 <p>Looping:</p>
46 <ul>
47 <? (dotimes [x 10] ?>
48 <li><?= x ?></li>
49 <? ) ?>
50 </ul>
51
52 <p>Here's a date: <?= (Date.) ?></p>
53 </body>
54 </html>
55
56 Todo
57 ----
58
59 - Intrafile references. need a way of referring to the code in other
60 files. You can use the "use" macro, but if the other file hasn't
61 been loaded yet then the namespace won't exist. Ugh. Probably need
62 to add a "require" equivalent a la PHP.
63
64 - Performance. Currently, a stat is done everytime a page is
65 rendered; it should really on a variable expire.
66
67 - Need to make it easier to access params and whatnot.
Something went wrong with that request. Please try again.