Common.hs 777 B

1234567891011121314151617181920212223
  1. {-# LANGUAGE NoImplicitPrelude #-}
  2. {-# LANGUAGE OverloadedStrings #-}
  3. {-# LANGUAGE TemplateHaskell #-}
  4. {-# LANGUAGE MultiParamTypeClasses #-}
  5. {-# LANGUAGE TypeFamilies #-}
  6. -- | Common handler functions.
  7. module Handler.Common where
  8. import Data.FileEmbed (embedFile)
  9. import Import
  10. -- These handlers embed files in the executable at compile time to avoid a
  11. -- runtime dependency, and for efficiency.
  12. getFaviconR :: Handler TypedContent
  13. getFaviconR = do cacheSeconds $ 60 * 60 * 24 * 30 -- cache for a month
  14. return $ TypedContent "image/x-icon"
  15. $ toContent $(embedFile "config/favicon.ico")
  16. getRobotsR :: Handler TypedContent
  17. getRobotsR = return $ TypedContent typePlain
  18. $ toContent $(embedFile "config/robots.txt")