Added endpoints for styling.
authorsabadev <saba@sabadev.xyz>
Tue, 16 Mar 2021 01:35:45 +0000 (21:35 -0400)
committersabadev <dev@sabadev.xyz>
Tue, 13 Apr 2021 01:16:06 +0000 (21:16 -0400)
src/Server.hs

index dff3769..b0a5f5f 100644 (file)
@@ -1,8 +1,10 @@
 module Server where
 
+import CssContentType
 import Servant
 import Lucid
 import Servant.HTML.Lucid (HTML(..))
+import qualified Data.Text as T
 
 app :: Application
 app = serve apiProxy api
@@ -10,17 +12,29 @@ app = serve apiProxy api
 apiProxy :: Proxy Api
 apiProxy = Proxy
 
-type Api = MainPage :<|> BlogPost
+type Api = MainPage :<|> BlogPost :<|> Themes
 type MainPage = Get '[HTML] (Html ())
 type BlogPost = "blog" :> QueryParam "id" BlogId :> Get '[HTML] (Html ())
+type Themes = DarkTheme :<|> LightTheme
+type DarkTheme = "dark" :> Get '[CSS] T.Text
+type LightTheme = "light" :> Get '[CSS] T.Text
 
 type BlogId = Integer
 
 api :: Server Api
-api = mainPage :<|> blogPost
+api = mainPage :<|> blogPost :<|> themes
 
 mainPage :: Handler (Html ())
-mainPage = pure ()
+mainPage = undefined
 
-blogPost :: BlogId -> Handler (Html ())
-blogPost blogId = pure ()
+blogPost :: Maybe BlogId -> Handler (Html ())
+blogPost blogId = undefined
+
+themes :: Server Themes
+themes = darkTheme :<|> lightTheme
+
+darkTheme :: Handler T.Text
+darkTheme = undefined
+
+lightTheme :: Handler T.Text
+lightTheme = undefined