Factored HTML pages out into their own API.
authorsabadev <saba@sabadev.xyz>
Wed, 17 Mar 2021 11:16:20 +0000 (07:16 -0400)
committersabadev <dev@sabadev.xyz>
Tue, 13 Apr 2021 01:16:21 +0000 (21:16 -0400)
src/Server.hs

index f9506fb..8ab55d4 100644 (file)
@@ -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