summaryrefslogtreecommitdiff
path: root/Web/Views.hs
blob: b6ae013a8a958dee0c2cb5a03bf00688068ba082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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