1 import Network.HTTP.Lucu
4 main = let config = defaultConfig { cnfServerPort = "9999" }
5 resources = mkResTree [ ( []
9 , staticFile "/dev/urandom" )
12 , staticDir "/usr/include" )
14 fallbacks = [ \ path -> case path of
15 ["hello"] -> return $ Just helloWorld
19 do putStrLn "Access http://localhost:9999/ with your browser."
20 runHttpd config resources fallbacks
23 helloWorld :: ResourceDef
27 = Just $ do --time <- liftIO $ getClockTime
28 --foundEntity (strongETag "abcde") time
29 setContentType $ read "text/hello"
31 outputChunk "World!\n"
32 outputChunk =<< getRemoteAddr'
35 = Just $ do str1 <- inputChunk 3
38 setContentType $ read "text/hello"
39 output ("[" ++ str1 ++ " - " ++ str2 ++ "#" ++ str3 ++ "]")