espresso

This is the base module for starting the http server. It also does things like retrieve the system port and halts but the main thing is the start function.

Functions

pub fn start(r: Router(a, b, c, d)) -> Nil

Starts the server with a router and returns the pid of the process.

Example

import espresso
import espresso/request.{Request}
import espresso/response.{send}
import espresso/router.{get}

pub fn main() {
  let router =
    router.new()
    |> get("/", fn(_req: Request(BitString, assigns, session)) { send(202, "Main Route") })

  espresso.start(router)
}
Search Document