aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-10-25 12:24:08 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-10-25 12:24:08 +0300
commitbb607424b947f1dad571fe05c2044646073de201 (patch)
tree95f9d40cf2ddb9a89abe7030daf6bc26ad476292
parent22ba47e0f92161e0e3d93fa31afa57a33ea666d3 (diff)
downloadmywatch-bb607424b947f1dad571fe05c2044646073de201.tar.gz
Use gzip compression
-rw-r--r--src/Application.hs3
1 files changed, 3 insertions, 0 deletions
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")