Safe Haskell | None |
---|
ColtraneTypes
- data Route = Route {}
- data ResponseState = RS {}
- rsPlus :: ResponseState -> ResponseState -> ResponseState
- data HandlerState = HS {}
- data Server
- type ContentType = ByteString
- ctHTML :: ByteString
- ctText :: ByteString
- ctJSON :: ByteString
- ctFile :: ByteString
- type ResponseBody = String
- data Path
- type ParamKey = String
- type ParamValue = String
- type Params = [(ParamKey, ParamValue)]
- convertBSParams :: [Param] -> Params
- type Handler = HandlerM ()
- newtype ColtraneApp a = C {}
- newtype HandlerM a = HM {}
Documentation
a Route is composed of:
- a method (uses the StdMethod type from Network.HTTP.Types.Method)
- a path (defined below)
- a handler (defined below)
Instances
data ResponseState Source
A ResponseState holds a body, headers, and a status. When used with MonadState, this type makes it easy to add headers and change the response status; WAI does not provide simple mechanisms for modifying the headers and status.
data HandlerState Source
The HandlerState contains the parameters, the request object, and the response state.
Instances
Server options for running the application.
type ContentType = ByteStringSource
Stores the content-type constants for the response headers.
type ResponseBody = StringSource
A ResponseBody is a string.
A path is either a String Literal or a Regular Expression.
type ParamValue = StringSource
type Params = [(ParamKey, ParamValue)]Source
Key value pairs of URL parameters.
convertBSParams :: [Param] -> ParamsSource
Converts [Parse.Param] to Params.
Stores the current parameters, Request, and the ResponseState that gets 'built up' in a Handler; the response body, headers, and status may be altered. The HandlerM also has error handling capabilities. The Handler is the third component of a Route; a Method and a Path are associated with a Handler.