diff options
| author | Hannes Schulze <contact@haschu.me> | 2026-10-03 22:57:23 +0200 |
|---|---|---|
| committer | Hannes Schulze <contact@haschu.me> | 2026-10-03 22:57:23 +0200 |
| commit | b945c36d932efdaac36db284e82637bdf0193263 (patch) | |
| tree | 05015a734ad5a4be07e3e35832090919f6ac054a /src/Main.hs | |
| parent | 0bffdaf882a9ecdae7887ac59223ed489c96dc64 (diff) | |
minor
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Main.hs b/src/Main.hs index 20da414..9fda84b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,20 +1,20 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE LambdaCase #-} -import Network.CGI (runCGI, handleErrors, CGIResult, CGI, outputFPS) +import Network.CGI (runCGI, handleErrors, outputFPS, setHeader) import Text.Blaze.Html.Renderer.Utf8 (renderHtml) -import Settlr.Config (withConfig) +import Settlr.Config (withConfig, ScriptM) import Settlr.Routes (loadRoute, Route(..)) import Settlr.Views.ErrorNotFound (viewErrorNotFound) import Settlr.Views.Home (viewHome) +import Text.Blaze.Html5 (Html) -cgiMain :: CGI CGIResult -cgiMain = withConfig $ do - view <- loadRoute >>= \case - Nothing -> viewErrorNotFound - Just RouteHome -> viewHome - Just RouteNew -> viewErrorNotFound - outputFPS (renderHtml view) +view :: Maybe Route -> ScriptM Html +view (Just RouteHome) = viewHome +view (Just RouteNew) = viewErrorNotFound +view Nothing = viewErrorNotFound main :: IO () -main = runCGI (handleErrors cgiMain) +main = runCGI $ handleErrors $ withConfig $ do + setHeader "Content-type" "text/html; charset=\"utf-8\"" + loadRoute >>= view >>= outputFPS . renderHtml |
