summaryrefslogtreecommitdiff
path: root/Main.hs
blob: 1bc06d584aefd96df6c340b064b097eb6006f9f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Main where

import System.IO
import Response
import Router

renderTemplate name = do
  template <- readTemplate name
  return $ HtmlResponse 200 template

readTemplate name = do
  handle <- openFile ("templates/" ++ name) ReadMode
  hGetContents handle

route url method
  | url == "/"      = renderTemplate "index.html"
  | url == "/hello" = renderTemplate "hello.html"

table = [
  Route 
]

main = do
  response <- route "/hello" "GET"
  print $ getContent response