Wheb-0.1.0.0: The frictionless WAI Framework

Safe HaskellNone

Web.Wheb.Routes

Contents

Synopsis

URL building

(</>) :: UrlPat -> UrlPat -> UrlPatSource

Allows for easier building of URL patterns This should be the primary URL constructor.

 (\"blog\" '</>' ('grabInt' \"pk\") '</>' \"edit\" '</>' ('grabText' \"verb\"))

grabInt :: Text -> UrlPatSource

Parses URL parameter and matches on Int

grabText :: Text -> UrlPatSource

Parses URL parameter and matches on Text

pT :: Text -> UrlPatSource

Constructors to use w/o OverloadedStrings

Convenience constructors

patRoute :: Maybe Text -> StdMethod -> UrlPat -> WhebHandlerT g s m -> Route g s mSource

Build a Route from a UrlPat

URL Patterns

rootPat :: UrlPatSource

Represents root path /

Working with URLs

getParam :: Typeable a => Text -> RouteParamList -> Maybe aSource

Lookup and cast a URL parameter to its expected type if it exists.

matchUrl :: [Text] -> UrlParser -> Maybe RouteParamListSource

Convert URL chunks (split on /)

findUrlMatch :: StdMethod -> [Text] -> [Route g s m] -> Maybe (WhebHandlerT g s m, RouteParamList)Source

Sort through a list of routes to find a Handler and RouteParamList

Utilities

testUrlParser :: UrlParser -> RouteParamList -> BoolSource

Test a parser to make sure it can match what it produces and vice versa