From: sabadev Date: Tue, 16 Mar 2021 01:35:45 +0000 (-0400) Subject: Added endpoints for styling. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=f8c407b42a9aa2e47fc4692e30ec5ac40af92178;p=website.git Added endpoints for styling. --- diff --git a/src/Server.hs b/src/Server.hs index dff3769..b0a5f5f 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -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