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

Portabilitynon-portable (uses ghc extensions)
Safe HaskellNone




Defines a Routing Monad that provides easy composition of Routes


Route Monad

data RouteM a Source

The Route Monad

Compose Routes

defaultAction :: Application -> RouteM ()Source

Set the default action of the Application. You should only call this once in an application. Subsequent invocations override the previous settings.

middleware :: Middleware -> RouteM ()Source

Add a middleware to the application. Middleware is nested so the one declared earlier is outer.

route :: Routable master => master -> RouteM ()Source

Add a route to the application. Routes are ordered so the one declared earlier is matched first.

Convert to Wai Application

toWaiApp :: RouteM () -> IO ApplicationSource

Convert a RouteM Monadic value into a wai application.