forked from swannodette/enlive-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate1.clj
More file actions
23 lines (19 loc) · 711 Bytes
/
template1.clj
File metadata and controls
23 lines (19 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns tutorial.template1
(:require [net.cgrand.enlive-html :as html])
(:use [net.cgrand.moustache :only [app]]
[tutorial.utils :only [run-server render-to-response]]))
(html/deftemplate index "tutorial/template1.html"
[ctxt]
[:p#message] (html/content (:message ctxt)))
;; ========================================
;; The App
;; ========================================
(def routes
(app
[""] (fn [req] (render-to-response
(index {})))
["change"] (fn [req] (render-to-response
(index {:message "We changed the message!"})))
[&] {:status 404
:body "Page Not Found"}))
(defonce *server* (run-server routes))