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