From f5dc9423bb76b1d6d5cb99a168e780ecb30352fa Mon Sep 17 00:00:00 2001 From: sabadev Date: Wed, 17 Mar 2021 07:16:20 -0400 Subject: [PATCH] Factored HTML pages out into their own API. --- src/Server.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Server.hs b/src/Server.hs index f9506fb..8ab55d4 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -19,7 +19,8 @@ app = serve apiProxy api apiProxy :: Proxy Api apiProxy = Proxy -type Api = MainPage :<|> BlogPost :<|> Themes +type Api = Page :<|> Themes +type Page = MainPage :<|> BlogPost type MainPage = Get '[HTML] (Html ()) type BlogPost = "blog" :> Capture "id" BlogId :> Get '[HTML] (Html ()) type Themes = DarkTheme :<|> LightTheme @@ -29,7 +30,10 @@ type LightTheme = "light" :> Get '[CSS] C.Css type BlogId = FilePath api :: Server Api -api = mainPage :<|> blogPost :<|> themes +api = page :<|> themes + +page :: Server Page +page = mainPage :<|> blogPost mainPage :: Handler (Html ()) mainPage = htmlContainer $ h1_ $ toHtml siteTitle -- 2.20.1