wisp/wisp_mist

Functions

pub fn handler(
  handler: fn(Request(Connection)) -> Response(Body),
  secret_key_base: String,
) -> fn(Request(mist/internal/http.Connection)) ->
  Response(ResponseData)

Convert a Wisp request handler into a function that can be run with the Mist web server.

Examples

pub fn main() {
  let secret_key_base = "..."
  let assert Ok(_) =
    handle_request
    |> wisp_mist.handler(secret_key_base)
    |> mist.new
    |> mist.port(8000)
    |> mist.start_http
  process.sleep_forever()
}
Search Document