Safe Haskell | None |
---|---|
Language | Haskell2010 |
- openTestSocket :: IO (PortNumber, Socket)
- startDaemon :: IO () -> IO (Async ())
- stopDaemon :: Async () -> IO ()
- staticReplyServer :: Maybe Status -> Maybe SBS -> LBS -> Application
- routingReplyServer :: Maybe SBS -> Map SBS (Status, LBS) -> Application
Documentation
openTestSocket :: IO (PortNumber, Socket)
startDaemon :: IO () -> IO (Async ())
Start a background processes.
stopDaemon :: Async () -> IO ()
Stop a background processes.
staticReplyServer :: Maybe Status -> Maybe SBS -> LBS -> Application
Simple server that replies to all requests with the same response. Takes an optional status code (default: 200 OK), an optional content type (default: application/json), and a response body.
routingReplyServer :: Maybe SBS -> Map SBS (Status, LBS) -> Application
Somewhat more refined reply server that looks up the route in a map and replies with the status and response defined for that route. Routes must match *exactly,* not just by prefix. All replies must have the same content type (first argument, default: application/json). Returns 404 and a simple plain-text body if no matching route is found.