-main :: IO ()
-main = let config = defaultConfig { cnfServerPort = PortNumber 9999 }
- resources = mkResTree [ ( []
- , helloWorld )
-
- , ( ["index.html"]
- , staticFile "/Users/admin/Sites/index.html" )
-
- , ( ["urandom"]
- , staticFile "/dev/urandom" )
-
- , ( ["inc"]
- , staticDir "/usr/include" )
- ]
+main ∷ IO ()
+main = let config = defaultConfig { cnfServerPort = "9999" }
+ mapper = resourceMap resources ⊕ resourceMap fallbacks
+ resources ∷ ResourceTree
+ resources = C.fromList
+ [ ([] , nonGreedy helloWorld)
+ , (["urandom" ], nonGreedy $ staticFile "/dev/urandom")
+ , (["inc" ], greedy $ staticDir "/usr/include")
+ , (["inc", "t"], nonGreedy $ staticFile "/usr/include/time.h")
+ ]
+ fallbacks ∷ Path → Maybe (Path, Resource)
+ fallbacks path
+ | path ≡ ["hello"] = Just (path, helloWorld)
+ | otherwise = Nothing