blob: c99a0df015d0db28ef75629c97de69445d7f91b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
(ns cljssss-g
(require [clojure.xml :as xml]
[clojure.contrib.sql :as sql]
compojure)
(import (org.antlr.stringtemplate StringTemplateGroup))
(use compojure))
(Class/forName "org.sqlite.JDBC")
(def templates (new StringTemplateGroup ""))
(defservlet cljssss-g
(GET "/"
(.toString
(doto (.getInstanceOf templates "index")
(.setAttributes {"title" "Subscriptions",
"mainParagraph" "Hi there!"}))))
(ANY "*"
(page-not-found)))
(defmacro with-db [& body]
`(sql/with-connection {:classname "org.sqlite.JDBC"
:subprotocol "sqlite"
:subname "cljssss-g.sqlite3"}
(sql/transaction
~@body)))
(run-server {:port 8080}
"/*" cljssss-g)
|