Web Module

Functions and values

Function or value Description

defaultConfig

Full Usage: defaultConfig

Returns: SuaveConfig

The default configuration binds on IPv4, 127.0.0.1:8080 with a regular 500 Internal Error handler, with a timeout of one minute for computations to run. Waiting for 2 seconds for the socket bind to succeed.

Returns: SuaveConfig

defaultErrorHandler ex msg ctx

Full Usage: defaultErrorHandler ex msg ctx

Parameters:
Returns: Async<HttpContext option>

The default error handler returns a 500 Internal Error in response to thrown exceptions.

ex : Exception
msg : 'a
ctx : HttpContext
Returns: Async<HttpContext option>

startWebServer config webpart

Full Usage: startWebServer config webpart

Parameters:

Runs the web server and blocks waiting for the asynchronous workflow to be cancelled or it returning itself.

config : SuaveConfig
webpart : WebPart

startWebServerAsync config webpart

Full Usage: startWebServerAsync config webpart

Parameters:
Returns: Async<StartedData option array> * Task

Starts the web server asynchronously. Returns the webserver as a tuple of 1) an async computation that yields startup metrics DTOs when the web server is ready to serve requests, and 2) an async computation that yields when the web server is being shut down and is being terminated. The async values returned are not 'hot' in the sense that they have started running, so you must manually start the 'server' (second item in tuple), as this starts the TcpListener. Have a look at the example and the unit tests for more documentation. In other words: don't block on 'listening' unless you have started the server. The return value from 'listening' (first item in tuple) gives you some metrics on how quickly suave started.

config : SuaveConfig
webpart : WebPart
Returns: Async<StartedData option array> * Task