Skip to content
Snippets Groups Projects
Verified Commit 5df3fd9d authored by jan.hamal.dvorak's avatar jan.hamal.dvorak
Browse files

Showcase wrapping a little bit more

parent 699fd897
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ where
import Control.Monad.Reader
import Data.Text (Text)
import Lucid
import Network.HTTP.Types.Header
import Network.HTTP.Types.Status
import Network.Wai
import Network.Wai.Handler.Warp
......@@ -98,10 +99,15 @@ where
-- Plug in a cool logging middleware.
middleware $ logStdoutDev
-- Enable 300s cache for the static endpoints.
wrapAction (defaultHeader hCacheControl "public, max-age=300" >>) $ do
-- Negotiate content for the root page.
route $ getRootHtmlR <$ get <* offerHTML
route $ getRootTextR <$ get <* offerText
-- Disable caching for all the following endpoints.
wrapActions (defaultHeader hCacheControl "no-store" >>)
-- Present a simple greeting page.
route $ getHelloR <$ get <* seg "hello" <*> arg
<* offerText
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment