packages feed

warp-static 0.0.1 → 0.0.2

raw patch · 2 files changed

+11/−3 lines, 2 filesdep +wai-extra

Dependencies added: wai-extra

Files

warp-static.cabal view
@@ -1,5 +1,5 @@ Name:                warp-static-Version:             0.0.1+Version:             0.0.2 Synopsis:            Static file server based on Warp and wai-app-static Homepage:            http://github.com/snoyberg/warp-static License:             BSD3@@ -16,5 +16,6 @@   Build-depends: base            >= 4                  && < 5                , warp            >= 0.3                && < 0.4                , wai-app-static  >= 0.0                && < 0.1+               , wai-extra       >= 0.3.3              && < 0.4                , cmdargs         >= 0.6.7              && < 0.7                , directory       >= 1.0                && < 1.2
warp.hs view
@@ -8,6 +8,9 @@ import Text.Printf (printf) import System.Directory (canonicalizePath) import Control.Monad (unless)+import Network.Wai.Middleware.Autohead+import Network.Wai.Middleware.Debug+import Network.Wai.Middleware.Gzip  data Args = Args     { docroot :: FilePath@@ -15,10 +18,11 @@     , port :: Int     , noindex :: Bool     , quiet :: Bool+    , verbose :: Bool     }     deriving (Show, Data, Typeable) -defaultArgs = Args "." ["index.html", "index.htm"] 3000 False False+defaultArgs = Args "." ["index.html", "index.htm"] 3000 False False False  main :: IO () main = do@@ -26,7 +30,10 @@     docroot' <- canonicalizePath docroot     args <- getArgs     unless quiet $ printf "Serving directory %s on port %d with %s index files.\n" docroot' port (if noindex then "no" else show index)-    run port $ staticApp StaticSettings+    let middle = gzip False+               . (if verbose then debug else id)+               . autohead+    run port $ middle $ staticApp StaticSettings         { ssFolder = docroot         , ssIndices = if noindex then [] else index         , ssListing = Just defaultListing