Safe Haskell | Safe |
---|---|
Language | Haskell98 |
This module exports a definition of a Controller
, which is simply a
DC
action with the Labeled
HTTP Request
in the environment
(i.e., it is a Reader
monad).
- type Controller = ReaderT ControllerState DC
- data ControllerState = ControllerState {}
- request :: Controller (DCLabeled Request)
- requestConfig :: Controller RequestConfig
- appPriv :: Controller DCPriv
- requestHeader :: HeaderName -> Controller (Maybe ByteString)
- body :: Controller ByteString
- queryParam :: ByteString -> Controller (Maybe ByteString)
- respond :: Routeable r => r -> Controller r
- redirectBack :: Controller Response
- redirectBackOr :: Response -> Controller Response
Documentation
type Controller = ReaderT ControllerState DC Source
data ControllerState Source
request :: Controller (DCLabeled Request) Source
Get the underlying request.
requestHeader :: HeaderName -> Controller (Maybe ByteString) Source
Get a request header
body :: Controller ByteString Source
Extract the body in the request (after unlabeling it).
queryParam :: ByteString -> Controller (Maybe ByteString) Source
Get the query parameter mathing the supplied variable name.
respond :: Routeable r => r -> Controller r Source
Produce a response.
redirectBack :: Controller Response Source
Redirect back acording to the referer header. If the header is
not present redirect to root (i.e., /
).
redirectBackOr :: Response -> Controller Response Source
Redirect back acording to the referer header. If the header is not present return the given response.