web-inv-route-0.1: Composable, reversible, efficient web routing based on invertible invariants and bijections

Safe HaskellNone
LanguageHaskell2010

Web.Route.Invertible.URI

Description

Conversion between Network.URI and routable representations such as Request.

The most useful function here is routeActionURI which performs reverse routing. If you have an action already defined:

getThing :: 'RouteAction' Int (IO Response)

Then routeActionURI getThing 123 will return the method and URI for that route, filling in the placeholders appropriately, e.g., (GET, "/thing/123").

Synopsis

Documentation

requestURI :: Request -> URI Source

Convert a request to a URI, ignoring the method.

uriRequest :: IsMethod m => m -> URI -> Request Source

Convert a method and URI to a request.

uriGETRequest :: URI -> Request Source

Convert a GET URI to a request.

routeActionURI :: RouteAction r a -> r -> (Method, URI) Source

Reverse a route action to a URI.