Portability | non-portable (uses ghc extensions) |
---|---|
Stability | experimental |
Maintainer | ajnsit@gmail.com |
Safe Haskell | None |
Provides a HandlerM Monad that makes it easy to build Handlers
- type HandlerM master a = HandlerMI master IO a
- runHandlerM :: HandlerM master () -> Handler master
- request :: HandlerM master Request
- master :: HandlerM master master
- header :: HeaderName -> ByteString -> HandlerM master ()
- status :: Status -> HandlerM master ()
- raw :: ByteString -> HandlerM master ()
- json :: ToJSON a => a -> HandlerM master ()
- text :: Text -> HandlerM master ()
- html :: ByteString -> HandlerM master ()
- next :: HandlerM master ()
Documentation
A Monad that makes it easier to build a Handler
runHandlerM :: HandlerM master () -> Handler masterSource
Run HandlerM, resulting in a Handler
Run a HandlerM to get a Handler
Access the request data
Access the master datatype
header :: HeaderName -> ByteString -> HandlerM master ()Source
Add a header to the application response TODO: Differentiate between setting and adding headers
Add a header to the response
Set the response status
raw :: ByteString -> HandlerM master ()Source
Set the response body TODO: Add functions to append to body, and also to flush body contents
Set the raw response body
json :: ToJSON a => a -> HandlerM master ()Source
Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json".
Set the json response body
text :: Text -> HandlerM master ()Source
Set the body of the response to the given Text
value. Also sets "Content-Type"
header to "text/plain".
Set the text response body
html :: ByteString -> HandlerM master ()Source
Set the body of the response to the given Text
value. Also sets "Content-Type"
header to "text/html".
Set the html response body
Run the next application in the stack