@@ -0,0 +1,21 @@
1+import Network.Wai.Application.Static
2+ ( StaticSettings (..), staticApp, defaultMimeTypeByExt, defaultListing
3+ )
4+import Network.Wai.Handler.Warp (run)
5+import System.Environment (getArgs)
6+
7+main :: IO ()
8+main = do
9+ args <- getArgs
10+ (folder, port) <- return $
11+ case args of
12+ [] -> (".", 3000)
13+ [f] -> (f, 3000)
14+ [f, p] -> (f, read p)
15+ _ -> error "Usage: warp-static [root [port]]"
16+ run port $ staticApp StaticSettings
17+ { ssFolder = folder
18+ , ssIndices = ["index.html", "index.htm"]
19+ , ssListing = Just defaultListing
20+ , ssGetMimeType = return . defaultMimeTypeByExt
21+ }