Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 27 days ago
JSON representation
🍛 A Gleam HTTP service adapter for the Elli web server
- Host: GitHub
- URL: https://github.com/gleam-lang/elli
- Owner: gleam-lang
- License: apache-2.0
- Created: 2019-03-23T19:26:42.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T12:10:29.000Z (9 months ago)
- Last Synced: 2024-03-14T20:53:43.940Z (9 months ago)
- Topics: erlang, gleam, http
- Language: Gleam
- Homepage:
- Size: 75.2 KB
- Stars: 37
- Watchers: 5
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - gleam_elli - [📚](https://hexdocs.pm/gleam_elli/) - Run Gleam HTTP services with the Elli web server (Packages / HTTP Servers)
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.{type Request}
import gleam/http/response.{type Response}
import gleam/bytes_builder.{type BytesBuilder}// Define a HTTP service
//
pub fn my_service(req: Request(t)) -> Response(BytesBuilder) {
let body = bytes_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)
}
```