• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language Gleam
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ•ΈοΈ Types and functions for HTTP clients and servers!

Gleam HTTP

Types and functions for HTTP clients and servers!

HTTP Service Example

import gleam/http/elli
import gleam/http/response.{type Response}
import gleam/http/request.{type Request}
import gleam/bytes_builder.{type BytesBuilder}

// Define a HTTP service
//
pub fn my_service(_request: 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 using the Elli web server
//
pub fn main() {
  elli.become(my_service, on_port: 3000)
}

Server adapters

In the example above the Elli Erlang web server is used to run the Gleam HTTP service. Here's a full list of the server adapters available, sorted alphabetically.

Adapter About
Mist Mist is a high performance pure Gleam HTTP 1.1 server
cgi cgi is a adapter for the Common Gateway Interface.
gleam_cowboy Cowboy is an Erlang HTTP2 & HTTP1.1 web server
gleam_elli Elli is an Erlang HTTP1.1 web server
gleam_plug Plug is an Elixir web application interface

Client adapters

Client adapters are used to send HTTP requests to services over the network. Here's a full list of the client adapters available, sorted alphabetically.

Adapter About
gleam_fetch fetch is a HTTP client included with JavaScript
gleam_hackney Hackney is a simple HTTP client for Erlang
gleam_httpc httpc is a HTTP client included with Erlang

More Repositories

1

gleam

⭐️ A friendly language for building type-safe, scalable systems!
Rust
17,409
star
2

awesome-gleam

πŸ’― A collection of Gleam libraries, projects, and resources
Gleam
1,225
star
3

stdlib

🎁 Gleam's standard library
Gleam
454
star
4

otp

πŸ“« Fault tolerant multicore programs with actors
Gleam
413
star
5

mix_gleam

βš—οΈ Build Gleam code with mix
Elixir
166
star
6

vscode-gleam

πŸ“Ÿ Gleam support for VS Code
TypeScript
153
star
7

example-todomvc

πŸ“ An example web application in Gleam
Gleam
119
star
8

gleam.vim

✌️ Gleam support for Vim/Neovim
Vim Script
100
star
9

website

🏑 Gleam's website and guide
HTML
90
star
10

json

πŸ‘ Work with JSON in Gleam!
Gleam
86
star
11

language-tour

πŸ‘©πŸ½β€πŸ’» Learn Gleam in your browser
Gleam
82
star
12

gleam-mode

πŸ™ Gleam support for Emacs
Emacs Lisp
79
star
13

erlang

πŸ™ Extra code for when running on Erlang
Gleam
79
star
14

example-echo-server

πŸ”— An example Gleam web application
Gleam
75
star
15

tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
JavaScript
71
star
16

httpc

πŸ“‘ Make requests to HTTP servers with httpc
Gleam
70
star
17

packages

πŸ“¦ Search for Gleam packages
Gleam
67
star
18

cowboy

🀠 A Gleam HTTP service adapter for the Cowboy web server
Gleam
64
star
19

elli

πŸ› A Gleam HTTP service adapter for the Elli web server
Gleam
60
star
20

javascript

🌼 Extra code for when running on JavaScript
Gleam
52
star
21

hackney

πŸͺ Make requests to HTTP servers with Hackney
Gleam
37
star
22

fetch

πŸ“‘ Make requests to HTTP servers with fetch
Gleam
35
star
23

crypto

⛓️ Crypto functionality for Gleam applications
Gleam
34
star
24

plug

πŸ”Œ A Gleam HTTP service adapter for the Plug web application interface
Elixir
32
star
25

example-lisp-interpreter

πŸ‘Ύ A Lisp interpreter in Gleam!
Gleam
32
star
26

suggestions

πŸ“™ A place for ideas and feedback
26
star
27

template-gleam-javascript

JavaScript support is built into the Gleam build tool, so this is no longer needed!
JavaScript
24
star
28

setup-erlang

πŸ‘· Erlang/OTP on GitHub Actions
PowerShell
22
star
29

hexpm-rust

βš—οΈ A Rust client for the Hex package manager
Rust
21
star
30

playground

Gleam
18
star
31

setup-gleam

πŸ‘·β€β™€οΈ Gleam on GitHub Actions
Shell
17
star
32

rebar_gleam

🧰 Build Gleam code with rebar3
Erlang
15
star
33

gleam-highlight.js

🎨 Gleam syntax highlighting with Highlight.js
JavaScript
11
star
34

developer-survey

πŸ—Ί Learning about the Gleam community
Gleam
11
star
35

bitwise

πŸ“ Bitwise operations on integers
Gleam
10
star
36

gleam-v0.17-example

JavaScript
7
star
37

branding

7
star
38

exercism-gleam

Exercises to be ported to https://github.com/exercism/gleam
Rust
6
star
39

package-interface

πŸ“¦ Work with Gleam's package interfaces
Gleam
5
star
40

gleam-compiler-ci-test

Rust
5
star
41

should_assertions

☝️ EUnit compatible assertion functions for use in tests
Gleam
5
star
42

.github

πŸ“œ Organisation wide GitHub configuration files
2
star
43

hexpm

πŸͺ„ Decoders for the Hex API
Gleam
1
star