summaryrefslogtreecommitdiff
path: root/Web/Views.hs
diff options
context:
space:
mode:
authorAndrew <saintruler@gmail.com>2020-11-27 17:50:54 +0400
committerAndrew <saintruler@gmail.com>2020-11-27 17:50:54 +0400
commit1cc6cfef971ccb3c1d70f2a5570e445556e4f6fb (patch)
tree4773f8178225068e19bd7418622f8dd9084543ac /Web/Views.hs
parentfb7e450d917ec87202f9de019238b78c1b645328 (diff)
Changed directory structure
Diffstat (limited to 'Web/Views.hs')
-rw-r--r--Web/Views.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Web/Views.hs b/Web/Views.hs
new file mode 100644
index 0000000..b6ae013
--- /dev/null
+++ b/Web/Views.hs
@@ -0,0 +1,20 @@
+module Web.Views where
+
+import System.IO
+
+import Web.Request
+import Web.Response
+
+indexGet (Request query url method) =
+ return $ HtmlResponse 200 "<strong>index</strong>"
+
+helloGet req =
+ return $ HtmlResponse 200 "<i>hello</i>"
+
+renderTemplate name = do
+ template <- readTemplate name
+ return $ HtmlResponse 200 template
+
+readTemplate name = do
+ handle <- openFile ("templates/" ++ name) ReadMode
+ hGetContents handle \ No newline at end of file