Skip to content

espresso-gleam/espresso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

espresso

This package is experimental and likely to change. Use at your own risk

Package Version Hex Docs

A simple to use HTTP server built on top of erlang's cowboy.

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)) { send(202, "Main Route") })

  espresso.start(router)
}

Environment Variables

  • PORT: the port to run the service on
  • ESPRESSO_SIGNING_SECRET: the secret used to sign the session cookie

Quick start

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell

Installation

If available on Hex this package can be added to your Gleam project:

gleam add espresso

and its documentation can be found at https://hexdocs.pm/espresso.