ContentsIndex
Framework.Urls
Description
URL dispatcher
Synopsis
data URLConf
= Action HttpAction
| OneOf URLConf URLConf
| Function StrAction
| Prefix String URLConf
| Regexp String URLConf
| RegexpFun String StrAction
| ManyRegexpFun URLParts URLParts ManyStrAction
| RawFunction StaticAction
runURLConf :: StaticConfig -> HttpRequest -> String -> URLConf -> IO HttpResponse
type StrAction = String -> HttpController
type StaticAction = HttpRequest -> String -> StaticController
type ManyStrAction = URLParts -> HttpController
type HttpAction = HttpController
(-->) :: String -> HttpAction -> URLConf
(//) :: String -> URLConf -> URLConf
(-\>) :: String -> StrAction -> URLConf
(~>) :: String -> StrAction -> URLConf
(~/) :: String -> URLConf -> URLConf
(~>>) :: String -> ManyStrAction -> URLConf
(<|>) :: URLConf -> URLConf -> URLConf
myUrl :: HttpRequest -> String
Documentation
data URLConf
URL dispatcher config
Constructors
Action HttpActionSimple answer, not depending on URL
OneOf URLConf URLConfTry to dispatch URL with first URLConf, if error then try second
Function StrActionAnswer depends on last URL part (basename)
Prefix String URLConfURLConf is executed only when URL starts with given prefix
Regexp String URLConfURLConf is executed only when current part of URL matches regexp
RegexpFun String StrActionSame, but answer depends on URL part
ManyRegexpFun URLParts URLParts ManyStrActionAnswer depends on many URL parts (which should match regexps) | After URLConf URLConf -- ^ Execute first URLConf, then second.
RawFunction StaticActionExecute StaticAction without connecting to DB or anything else
show/hide Instances
Show URLConf
runURLConf
:: StaticConfigStatic (global) config
-> HttpRequestHTTP request
-> StringURL itself
-> URLConfDispatcher configuration
-> IO HttpResponse
Main dispatcher function
type StrAction = String -> HttpController
Function which get one String argument and (maybe) returns Response
type StaticAction = HttpRequest -> String -> StaticController
Function which get request and one String argument and returns Response
type ManyStrAction = URLParts -> HttpController
Function which get many String arguments and (maybe) returns Response
type HttpAction = HttpController
Function which just returns Response
(-->) :: String -> HttpAction -> URLConf
If current part of URL is equal to given string, then call given function
(//) :: String -> URLConf -> URLConf
If current part of URL is equal to given string, then work with given URLConf
(-\>) :: String -> StrAction -> URLConf
If current part of URL matches given string, then run function
(~>) :: String -> StrAction -> URLConf
Same as RegexpFun
(~/) :: String -> URLConf -> URLConf
Forms ManyRegexpFun
(~>>) :: String -> ManyStrAction -> URLConf
Ends form ManyRegexpFun
(<|>) :: URLConf -> URLConf -> URLConf
Same as OneOf
myUrl :: HttpRequest -> String
Get URL from Request
Produced by Haddock version 2.4.2