summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
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
}