Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gleam-lang/elli

🍛 A Gleam HTTP service adapter for the Elli web server
https://github.com/gleam-lang/elli

erlang gleam http

Last synced: 3 months ago
JSON representation

🍛 A Gleam HTTP service adapter for the Elli web server

Awesome Lists containing this project

README

        

# Elli

A basic Gleam HTTP service adapter for the Elli web server.

```
gleam add gleam_elli gleam_http
```
```gleam
import gleam/http/elli
import gleam/http/request.{Request}
import gleam/http/response.{Response}
import gleam/bytes_builder.{BytesBuilder}

// Define a HTTP service
//
pub fn my_service(req: Request(t)) -> Response(BytesBuilder) {
let body = bit_builder.from_string("Hello, world!")

response.new(200)
|> response.prepend_header("made-with", "Gleam")
|> response.set_body(body)
}

// Start it on port 3000!
//
pub fn main() {
elli.become(my_service, on_port: 3000)
}
```