glen

Package Version Hex Docs

🏕️ A peaceful web framework for Gleam that targets JS.

✨ Features:

…and other nice-to-haves!

Installation

Install all requirements:

gleam add glen gleam_http gleam_javascript

Or just Glen:

gleam add glen

Usage

import gleam/javascript/promise.{type Promise}
import glen
import glen/status

pub fn main() {
 glen.serve(handle_req, 8000)
}

fn handle_req(req: glen.Request) -> Promise(glen.Response) {
 "<h1>Welcome to my webpage!</h1>
 <p>Make yourself at home 😄</p>"
 |> glen.html(status.ok)
 |> promise.resolve
}

Glen is heavily based off of Wisp, and many of Wisp’s examples can easily be ported to Glen. Glen also has an example application of its own in ./test.

Further documentation can be found at https://hexdocs.pm/glen.

Development

gleam run   # Run the project
gleam test  # Run the example application
Search Document