diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-07-23 23:54:43 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-07-23 23:54:43 +0100 |
commit | 0f41ec16f14b0dbc26f633a01c3cbbcd0dbda75e (patch) | |
tree | e7b04ccaece43e3a2a35a2b9ab5868bee403279f /Server/Main.hs | |
parent | 32ec9fa454e1d6a670d8b7fe193458d59b62ca63 (diff) | |
download | numberdisplay-0f41ec16f14b0dbc26f633a01c3cbbcd0dbda75e.tar.gz numberdisplay-0f41ec16f14b0dbc26f633a01c3cbbcd0dbda75e.tar.bz2 numberdisplay-0f41ec16f14b0dbc26f633a01c3cbbcd0dbda75e.zip |
(Server)~abstract headers into seperate constant
Instead of repeating it for every new route, just set as a constant.
Diffstat (limited to 'Server/Main.hs')
-rw-r--r-- | Server/Main.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Server/Main.hs b/Server/Main.hs index 8954d6d..bed3f82 100644 --- a/Server/Main.hs +++ b/Server/Main.hs @@ -8,6 +8,9 @@ import Network.Wai import Network.HTTP.Types import Network.Wai.Handler.Warp (run) +headers :: ResponseHeaders +headers = [("Content-Type", "text/html;charset=UTF-8")] + app :: Application app request respond = respond $ case rawPathInfo request of @@ -17,7 +20,7 @@ app request respond = respond $ index :: Response index = responseFile status200 - [("Content-Type", "text/html;charset=UTF-8")] + headers "pages/index.html" Nothing @@ -28,7 +31,7 @@ index = errorResponse :: Response errorResponse = responseFile status200 - [("Content-Type", "text/html;charset=UTF-8")] + headers "pages/error.html" Nothing |