diff options
| author | unwox <me@unwox.com> | 2024-06-06 16:08:54 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-06-06 16:08:54 +0600 |
| commit | 9c4a7fd604eafb716e9162fded33a151bd2fb515 (patch) | |
| tree | 2eae2ec9753227605c1a027c82a9ef7e8534b497 /init.fnl | |
| parent | 97a480249e7c8f605efd7a4252449791eabc90a8 (diff) | |
simple fennel setup
Diffstat (limited to 'init.fnl')
| -rw-r--r-- | init.fnl | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -1,9 +1,17 @@ (local fennel (require :fennel)) -{ - :routes { - :/ (fn [method path headers body] - (values 200 { :content-type "applicaton/json" } - "{ \"test\": 123 }")) - ; :/test (fn [] "test?") - } -} +(local html (require :html)) + +(local template + [:html {:lang "en"} + [:head {} + [:meta {:charset "UTF-8"}] + [:title {} "A new cool web server for lua"]] + [:body {} + [:h1 {} "Hello!"] + [:pre {} "This is my super blog!"]]]) + +(fn root-handler [method path headers body] + (let [headers { :content-type "text/html" }] + (values 200 headers (html.render template)))) + +{ :routes { :/ root-handler } } |
