small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
README.md
# mist [![Package Version](https://img.shields.io/hexpm/v/mist)](https://hex.pm/packages/mist) [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/mist/) ## A glistening Gleam web server. To follow along with the example below, you can create a new project and add the dependencies as follows: ```sh $ gleam new <your_project> $ cd <your_project> $ gleam add mist logging gleam_erlang gleam_http ``` The main entrypoint for your application is `mist.start`. The argument to this function is generated from the opaque `Builder` type. It can be constructed with the `mist.new` function, and fed updated configuration options with the associated methods (demonstrated in the examples below). ```gleam import gleam/bit_array import gleam/bytes_tree import gleam/erlang/process.{type Subject} import gleam/http/request.{type Request} import gleam/http/response.{type Response} import gleam/int import gleam/io import gleam/list import gleam/option.{None} import gleam/result import gleam/string import logging import mist.{type Connection, type ResponseData} const index = "<html lang='en'> <head> <title>Mist Example</title> </head> <body> Hello, world! </body> </html>" pub fn main() { logging.configure() logging.set_level(logging.Debug) let not_found = response.new(404) |> response.set_body(mist.Bytes(bytes_tree.new())) let assert Ok(_) = fn(req: Request(Connection)) -> Response(ResponseData) { let _ = case mist.get_connection_info(req.body) { Ok(info) -> { logging.log( logging.Info, "Got a request from: " <> mist.connection_info_to_string(info), ) } Error(_nil) -> { logging.log(logging.Info, "Failed to get connection info") } } case request.path_segments(req) { [] -> response.new(200) |> response.prepend_header("my-value", "abc") |> response.prepend_header("my-value", "123") |> response.set_body(mist.Bytes(bytes…