- runServer :: RequestPipeline a -> PortNumber -> IO ()
- data RequestPipeline a = RequestPipeline (RequestCreator a) (RequestProcessor a)
- type RequestCreator a = Parser a
- type RequestProcessor a = a -> IO Builder
Documentation
runServer :: RequestPipeline a -> PortNumber -> IO ()Source
Given a pipeline specification and a port, run TCP traffic using the pipeline for parsing, processing and response.
Note: there is currently no way for a server to specific the socket should be disconnected
data RequestPipeline a Source
The RequestPipeline
acts as a specification for your service,
indicating both a parser/request object generator, the RequestCreator,
and the processor of these requests, one that ultimately generates a
response expressed by a blaze Builder
type RequestCreator a = Parser aSource
The RequestCreator is an Attoparsec parser that yields some request
object a
type RequestProcessor a = a -> IO BuilderSource
The RequestProcessor is a function in the IO monad (for DB access, etc) that returns a builder that can generate the response