summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Preview/Server.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-12-29 09:53:59 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-12-29 09:53:59 +0100
commit720c92ab1ef628c3c9545fa022ed546c60d9d72a (patch)
treee9df7ae06004ae95acbb84eced7ecf0279759ba3 /src/Hakyll/Web/Preview/Server.hs
parent74e6ba9365cdc8fc550eef5e1dcf235a472e105e (diff)
downloadhakyll-720c92ab1ef628c3c9545fa022ed546c60d9d72a.tar.gz
Move preview modules
Diffstat (limited to 'src/Hakyll/Web/Preview/Server.hs')
-rw-r--r--src/Hakyll/Web/Preview/Server.hs40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/Hakyll/Web/Preview/Server.hs b/src/Hakyll/Web/Preview/Server.hs
deleted file mode 100644
index 15a1a33..0000000
--- a/src/Hakyll/Web/Preview/Server.hs
+++ /dev/null
@@ -1,40 +0,0 @@
--- | Implements a basic static file server for previewing options
---
-{-# LANGUAGE OverloadedStrings #-}
-module Hakyll.Web.Preview.Server
- ( staticServer
- ) where
-
-import Control.Monad.Trans (liftIO)
-
-import qualified Snap.Core as Snap
-import qualified Snap.Http.Server as Snap
-import qualified Snap.Util.FileServe as Snap
-
--- | Serve a given directory
---
-static :: FilePath -- ^ Directory to serve
- -> (FilePath -> IO ()) -- ^ Pre-serve hook
- -> Snap.Snap ()
-static directory preServe =
- Snap.serveDirectoryWith directoryConfig directory
- where
- directoryConfig :: Snap.DirectoryConfig Snap.Snap
- directoryConfig = Snap.fancyDirectoryConfig
- { Snap.preServeHook = liftIO . preServe
- }
-
--- | Main method, runs a static server in the given directory
---
-staticServer :: FilePath -- ^ Directory to serve
- -> (FilePath -> IO ()) -- ^ Pre-serve hook
- -> Int -- ^ Port to listen on
- -> IO () -- ^ Blocks forever
-staticServer directory preServe port =
- Snap.httpServe config $ static directory preServe
- where
- -- Snap server config
- config = Snap.setPort port
- $ Snap.setAccessLog Snap.ConfigNoLog
- $ Snap.setErrorLog Snap.ConfigNoLog
- $ Snap.emptyConfig