diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/Hakyll/SimpleServer.hs | 9 | ||||
-rw-r--r-- | src/Text/Hakyll.hs | 2 |
2 files changed, 6 insertions, 5 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 } diff --git a/src/Text/Hakyll.hs b/src/Text/Hakyll.hs index 9d2f86c..bafe4a8 100644 --- a/src/Text/Hakyll.hs +++ b/src/Text/Hakyll.hs @@ -45,4 +45,4 @@ help = do ++ name ++ " server [port] Run a local test server.\n" server :: Integer -> IO () -server p = do simpleServer (fromIntegral $ p) +server p = do simpleServer (fromIntegral $ p) "_site" |