summaryrefslogtreecommitdiff
path: root/Views.hs
blob: 9d2594e56b2d907b7530fa02d2eb4332c10fb179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Views where

import System.IO

import Request
import 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