Wheb-0.2.0.0: The frictionless WAI Framework

Safe HaskellNone
LanguageHaskell2010

Web.Wheb.Routes

Contents

Synopsis

URL building

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

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

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

grabInt :: Text -> UrlPat Source

Parses URL parameter and matches on Int

grabText :: Text -> UrlPat Source

Parses URL parameter and matches on Text

pT :: Text -> UrlPat Source

Constructors to use w/o OverloadedStrings

Convenience constructors

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

Build a Route from a UrlPat

URL Patterns

rootPat :: UrlPat Source

Represents root path /

Working with URLs

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

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

matchUrl :: [Text] -> UrlParser -> Maybe RouteParamList Source

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

findSocketMatch :: [Text] -> [SocketRoute g s m] -> Maybe (WhebSocket g s m, RouteParamList) Source

Sort through socket routes to find a match

Utilities

testUrlParser :: UrlParser -> RouteParamList -> Bool Source

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