From: sabadev Date: Wed, 17 Mar 2021 11:16:20 +0000 (-0400) Subject: Factored HTML pages out into their own API. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=f5dc9423bb76b1d6d5cb99a168e780ecb30352fa;p=website.git Factored HTML pages out into their own API. --- 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