Wheb-0.0.1.1: The Batteries-Included Haskell WAI Framework

Safe HaskellNone

Web.Wheb.Routes

Contents

Synopsis

Convenience constructors

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

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

URL Patterns

rootPat :: UrlPatSource

Represents root path /

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

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