2 import Network.HTTP.Lucu
5 main = let config = defaultConfig { cnfServerPort = PortNumber 9999 }
6 resources = mkResTree [ ( []
10 , staticFile "/dev/urandom" )
13 , staticDir "/usr/include" )
16 do putStrLn "Access http://localhost:9999/ with your browser."
17 runHttpd config resources
20 helloWorld :: ResourceDef
23 resUsesNativeThread = False
26 = Just $ do --time <- liftIO $ getClockTime
27 --foundEntity (strongETag "abcde") time
28 setContentType $ read "text/hello"
30 outputChunk "World!\n"
33 = Just $ do str1 <- inputChunk 3
36 setContentType $ read "text/hello"
37 output ("[" ++ str1 ++ " - " ++ str2 ++ "#" ++ str3 ++ "]")