@@ -4,23 +4,22 @@ import Network.Wai
44import Network.Wai.Enumerator
55import Network.Wai.Middleware.Gzip
66import Network.Wai.Middleware.Jsonp
7+import Network.Wai.Middleware.CleanPath
78import Network.Wai.Handler.SimpleServer
89
9−app :: Application
10−app req =
11− case unpack $ pathInfo req of
12− "/" -> return $ Response Status200 [] $ Right $ fromLBS
13− $ fromChunks $ flip map [1..10000] $ \i -> pack $
10+app :: [String] -> Application
11+app [] _ = return $ Response Status200 [] $ Right $ fromLBS
12+ $ fromChunks $ flip map [1..10000] $ \i -> pack $
1413 concat
1514 [ "<p>Just this same paragraph again. "
1615 , show i
1716 , "</p>"
1817 ]
19− "/test.html" -> return $ Response Status200 [] $ Left "test.html"
20− "/json" -> return $ Response Status200
21− [(ContentType, pack "application/json")]
22− $ Left "json"
23− _ -> return $ Response Status404 [] $ Left "../LICENSE"
18+app ["test.html"] _ = return $ Response Status200 [] $ Left "test.html"
19+app ["json"] _ =return $ Response Status200
20+ [(ContentType, pack "application/json")]
21+ $ Left "json"
22+app _ _ = return $ Response Status404 [] $ Left "../LICENSE"
2423
2524main :: IO ()
26−main = run 3000 $ jsonp $ gzip app
25+main = run 3000 $ jsonp $ gzip $ cleanPath app