Gzip support
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
-- import Lib
|
||||
import Data.Text.Lazy (Text)
|
||||
import Network.Wai.Handler.Warp (Port)
|
||||
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
|
||||
import Text.Blaze ((!))
|
||||
import Text.Blaze.Html.Renderer.Text (renderHtml)
|
||||
|
||||
import Network.HTTP.Types
|
||||
import Network.Wai.Middleware.Gzip
|
||||
import Web.Scotty as S
|
||||
|
||||
import qualified Control.Exception as E
|
||||
@@ -57,6 +59,9 @@ main = do
|
||||
let anyRoute = regex "^.*$"
|
||||
scotty port $ do
|
||||
|
||||
middleware $ gzip $ def { gzipFiles = GzipCompress }
|
||||
middleware logStdoutDev
|
||||
|
||||
-- GET requests
|
||||
get "/" $ do
|
||||
status ok200
|
||||
|
@@ -33,6 +33,7 @@ library
|
||||
, http-types >=0.12.4 && <0.13
|
||||
, scotty ==0.22.*
|
||||
, text >=2.1.1 && <2.2
|
||||
, wai-extra >=3.1.16 && <3.2
|
||||
, warp >=3.4.7 && <3.5
|
||||
default-language: Haskell2010
|
||||
|
||||
@@ -54,6 +55,7 @@ executable hs-server-exe
|
||||
, http-types >=0.12.4 && <0.13
|
||||
, scotty ==0.22.*
|
||||
, text >=2.1.1 && <2.2
|
||||
, wai-extra >=3.1.16 && <3.2
|
||||
, warp >=3.4.7 && <3.5
|
||||
default-language: Haskell2010
|
||||
|
||||
@@ -76,5 +78,6 @@ test-suite hs-server-test
|
||||
, http-types >=0.12.4 && <0.13
|
||||
, scotty ==0.22.*
|
||||
, text >=2.1.1 && <2.2
|
||||
, wai-extra >=3.1.16 && <3.2
|
||||
, warp >=3.4.7 && <3.5
|
||||
default-language: Haskell2010
|
||||
|
@@ -26,6 +26,7 @@ dependencies:
|
||||
- http-types >= 0.12.4 && < 0.13
|
||||
- scotty >= 0.22 && < 0.23
|
||||
- text >= 2.1.1 && < 2.2
|
||||
- wai-extra >= 3.1.16 && < 3.2
|
||||
- warp >= 3.4.7 && < 3.5
|
||||
|
||||
ghc-options:
|
||||
|
Reference in New Issue
Block a user