gliew

Types

pub opaque type Response

Functions

pub fn live_mount(mount mount: fn(a) -> Subject(b), with context: a, render render: fn(
    Option(b),
  ) -> Node(Event)) -> Node(Event)

Creates a HTML node tree that will be mounted and receive live updates with data on Subject(a) returned by the mount function.

pub fn on_click(node: Node(Event), do method: Method, to path: String) -> Node(
  Event,
)

Attaches an on-click handler to a node by specifying the HTTP method and path to make a request to when clicked.

pub fn response(status: Int) -> Response

Creates an empty response without a body.

pub fn serve(port: Int, handler: fn(Request(Body)) -> Response) -> Result(
  Nil,
  StartError,
)
pub fn view(node: Node(Event), status: Int) -> Response

Creates a view response.

pub fn with_body(response: Response, body: String) -> Response

Sets body of a response.

pub fn with_header(response: Response, key key: String, value value: String) -> Response

Adds a header to a response.

Search Document