wai-routes-0.8.0: Typesafe URLs for Wai applications.

Copyright(c) Anupam Jain 2013
LicenseMIT (see the file LICENSE)
Maintainerajnsit@gmail.com
Stabilityexperimental
Portabilitynon-portable (uses ghc extensions)
Safe HaskellNone
LanguageHaskell2010

Network.Wai.Middleware.Routes.Monad

Contents

Description

Defines a Routing Monad that provides easy composition of Routes

Synopsis

Route Monad

type RouteM = F RouterF Source

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