Copyright | (c) Anupam Jain 2013 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | ajnsit@gmail.com |
Stability | experimental |
Portability | non-portable (uses ghc extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Defines a Routing Monad that provides easy composition of Routes
- type RouteM = F RouterF
- middleware :: Middleware -> RouteM ()
- route :: Routable master master => master -> RouteM ()
- catchall :: Application -> RouteM ()
- defaultAction :: Application -> RouteM ()
- waiApp :: RouteM () -> Application
- toWaiApp :: Monad m => RouteM () -> m Application
Route Monad
Compose Routes
middleware :: Middleware -> RouteM () Source
Add a middleware to the application Middleware are ordered so the one declared earlier is wraps the remaining application.
route :: Routable master master => master -> RouteM () Source
Add a route to the application. Routes are ordered so the one declared earlier is matched first.
catchall :: Application -> RouteM () Source
Catch all routes and process them with the supplied application. Note: As expected from the name, no request proceeds past a catchall.
defaultAction :: Application -> RouteM () Source
Synonym of catchall
. Kept for backwards compatibility
Convert to Wai Application
waiApp :: RouteM () -> Application Source
Convert a RouteM monad into a wai application. Note: We ignore the return type of the monad
toWaiApp :: Monad m => RouteM () -> m Application Source
Similar to waiApp but returns the app in an arbitrary monad Kept for backwards compatibility