From 6907a35ac265c4d4eeb127befea481a84e59ad4a Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 26 Nov 2020 16:51:52 +0400 Subject: Added Http parsing --- Main.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs index 1bc06d5..8e3925e 100644 --- a/Main.hs +++ b/Main.hs @@ -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 -- cgit v1.2.3