summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-27 20:33:18 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-27 20:33:18 +0100
commitd47227ddbb3cc312691a62b8733d31105b21c8d9 (patch)
treed27e91bc4276876c45732894ef49f6154f95ca19 /src/Network
parent849b49aa53fcc50064854a44d34eb1cd04e502d3 (diff)
downloadhakyll-d47227ddbb3cc312691a62b8733d31105b21c8d9.tar.gz
Made document root configurable.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Hakyll/SimpleServer.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Network/Hakyll/SimpleServer.hs b/src/Network/Hakyll/SimpleServer.hs
index 63006f2..80c0ff1 100644
--- a/src/Network/Hakyll/SimpleServer.hs
+++ b/src/Network/Hakyll/SimpleServer.hs
@@ -159,14 +159,15 @@ respond handle = do
putHeader (key, value) = B.hPutStr handle $ key `B.append` B.pack ": "
`B.append` value `B.append` B.pack "\r\n"
--- | Start a simple http server on the given 'PortNumber'.
-simpleServer :: PortNumber -> IO ()
-simpleServer port = do
+-- | Start a simple http server on the given 'PortNumber', serving the given
+-- directory.
+simpleServer :: PortNumber -> FilePath -> IO ()
+simpleServer port root = do
putStrLn $ "Starting hakyll server on port " ++ show port ++ "..."
socket <- listenOn (PortNumber port)
forever (listen socket)
where -- A default configuration.
- config = ServerConfig { documentRoot = "_site"
+ config = ServerConfig { documentRoot = root
, portNumber = port
}