diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2017-06-19 11:57:23 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2017-06-19 11:57:23 +0200 |
commit | 67ecff7ad383640bc73d64edc2506c7cc648a134 (patch) | |
tree | 6d328e43c3ab86c29a2d775fabaa23618c16fb51 /src/Hakyll/Preview/Server.hs | |
parent | 2df3209bafa08e6b77ee4a8598fc503269513527 (diff) | |
download | hakyll-67ecff7ad383640bc73d64edc2506c7cc648a134.tar.gz |
Move src/ to lib/, put Init.hs in src/
Diffstat (limited to 'src/Hakyll/Preview/Server.hs')
-rw-r--r-- | src/Hakyll/Preview/Server.hs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/Hakyll/Preview/Server.hs b/src/Hakyll/Preview/Server.hs deleted file mode 100644 index a84016a..0000000 --- a/src/Hakyll/Preview/Server.hs +++ /dev/null @@ -1,35 +0,0 @@ --------------------------------------------------------------------------------- --- | Implements a basic static file server for previewing options -{-# LANGUAGE OverloadedStrings #-} -module Hakyll.Preview.Server - ( staticServer - ) where - - --------------------------------------------------------------------------------- -import Data.String -import qualified Network.Wai.Handler.Warp as Warp -import qualified Network.Wai.Application.Static as Static -import qualified Network.Wai as Wai -import Network.HTTP.Types.Status (Status) - --------------------------------------------------------------------------------- -import Hakyll.Core.Logger (Logger) -import qualified Hakyll.Core.Logger as Logger - -staticServer :: Logger -- ^ Logger - -> FilePath -- ^ Directory to serve - -> String -- ^ Host to bind on - -> Int -- ^ Port to listen on - -> IO () -- ^ Blocks forever -staticServer logger directory host port = do - Logger.header logger $ "Listening on http://" ++ host ++ ":" ++ show port - Warp.runSettings warpSettings $ - Static.staticApp (Static.defaultFileServerSettings directory) - where - warpSettings = Warp.setLogger noLog - $ Warp.setHost (fromString host) - $ Warp.setPort port Warp.defaultSettings - -noLog :: Wai.Request -> Status -> Maybe Integer -> IO () -noLog _ _ _ = return () |