From bb607424b947f1dad571fe05c2044646073de201 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 25 Oct 2016 12:24:08 +0300 Subject: Use gzip compression --- src/Application.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Application.hs b/src/Application.hs index 64f8dab..bdedd5e 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -28,6 +28,7 @@ import System.IO (stderr) import Web.Scotty (ScottyM, ActionM, middleware, json, file, addroute, get, delete, status, text, param, scottyApp) import qualified Data.HashMap.Lazy as HM +import qualified Network.Wai.Middleware.Gzip as Gzip import LogFormat (logFormat) @@ -43,6 +44,8 @@ myProcess :: Pools -> Middleware -> FilePath -> ScottyM () myProcess ps logger dataDir = do middleware logger + middleware $ Gzip.gzip Gzip.def {Gzip.gzipFiles = Gzip.GzipCompress} + middleware $ staticPolicy (hasPrefix "static" >-> addBase dataDir) get "/" $ file (dataDir ++ "/" ++ "index.html") -- cgit v1.2.3