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