lightspeed/framework/controller

Controller-style response and session/flash helpers.

Values

pub fn clear_flash(conn: http.Conn) -> http.Conn

Clear all flash entries.

pub fn drop_session(conn: http.Conn, key: String) -> http.Conn

Delete one session key.

pub fn get_flash(
  conn: http.Conn,
  key: String,
) -> option.Option(String)

Read one flash key.

pub fn get_session(
  conn: http.Conn,
  key: String,
) -> option.Option(String)

Read one session key.

pub fn halt(conn: http.Conn) -> http.Conn

Halt connection processing.

pub fn html(conn: http.Conn, body: String) -> http.Conn

Write an HTML 200 response.

pub fn internal_error(
  conn: http.Conn,
  reason: String,
) -> http.Conn

Write a 500 text response.

pub fn json(conn: http.Conn, body: String) -> http.Conn

Write a JSON 200 response.

pub fn not_found(conn: http.Conn) -> http.Conn

Write a 404 text response.

pub fn put_flash(
  conn: http.Conn,
  key: String,
  value: String,
) -> http.Conn

Set one flash key.

pub fn put_session(
  conn: http.Conn,
  key: String,
  value: String,
) -> http.Conn

Set one session key.

pub fn redirect(conn: http.Conn, to: String) -> http.Conn

Write a 302 redirect response with location.

pub fn text(conn: http.Conn, body: String) -> http.Conn

Write a text 200 response.

Search Document