diff options
| author | Andrew <saintruler@gmail.com> | 2020-11-26 16:51:52 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2020-11-26 16:51:52 +0400 |
| commit | 6907a35ac265c4d4eeb127befea481a84e59ad4a (patch) | |
| tree | c115faf536fe82d0e2a998a4b8a1529e3b6ccf16 /Main.hs | |
| parent | 446602fe336ad1c2a23e3d50d7cd1d1356fcc9de (diff) | |
Added Http parsing
Diffstat (limited to 'Main.hs')
| -rw-r--r-- | Main.hs | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -2,7 +2,9 @@ module Main where import System.IO import Response +import Request import Router +import Views renderTemplate name = do template <- readTemplate name @@ -12,14 +14,9 @@ readTemplate name = do handle <- openFile ("templates/" ++ name) ReadMode hGetContents handle -route url method - | url == "/" = renderTemplate "index.html" - | url == "/hello" = renderTemplate "hello.html" - -table = [ - Route -] +table = [ Route indexGet "/" "GET" + , Route helloGet "/hello" "GET" ] main = do - response <- route "/hello" "GET" + response <- resolve table (Request "query" "/jopa" "GET") print $ getContent response
\ No newline at end of file |