mist

Functions

pub fn main() -> Nil
pub fn run_service(port: Int, handler: fn(Request(BitString)) ->
    Response(BitBuilder), max_body_limit max_body_limit: Int) -> Result(
  Nil,
  StartError,
)

Runs an HTTP Request->Response server at the given port, with your defined handler. This will automatically read the full body contents up to the specified max_body_limit in bytes. If you’d prefer to have finer-grain control over this behavior, consider using mist.serve.

pub fn serve(port: Int, handler: fn(
    HandlerMessage,
    LoopState(State),
  ) -> Next(LoopState(State))) -> Result(Nil, StartError)

Slightly more flexible alternative to run_service. This allows hooking into the mist/http.{handler_func} method. Note that the request body will not be automatically read. You will need to call http.read_body.