diff options
| author | Andrew <saintruler@gmail.com> | 2020-11-27 17:40:04 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2020-11-27 17:40:04 +0400 |
| commit | fb7e450d917ec87202f9de019238b78c1b645328 (patch) | |
| tree | ca70481709864b5c6510009fe45a9d6b6f91dd8c /Views.hs | |
| parent | 039c96096bf8f2294850be79a88a0761a5f58acf (diff) | |
Added basic HTTP types
Diffstat (limited to 'Views.hs')
| -rw-r--r-- | Views.hs | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,5 +1,7 @@ module Views where +import System.IO + import Request import Response @@ -7,4 +9,12 @@ indexGet (Request query url method) = return $ HtmlResponse 200 "<strong>index</strong>" helloGet req = - return $ HtmlResponse 200 "<i>hello</i>"
\ No newline at end of file + 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 |