• Stars
    star
    128
  • Rank 271,488 (Top 6 %)
  • Language Gleam
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated about 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
14,118
star
2

awesome-gleam

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

otp

πŸ“« Fault tolerant multicore programs with actors
Gleam
311
star
4

stdlib

🎁 Gleam's standard library
Gleam
305
star
5

mix_gleam

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

vscode-gleam

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

website

🏑 Gleam's website and guide
HTML
69
star
8

example-todomvc

πŸ“ An example web application in Gleam
Gleam
66
star
9

gleam.vim

✌️ Gleam support for Vim/Neovim
Vim Script
64
star
10

example-echo-server

πŸ”— An example Gleam web application
Gleam
64
star
11

cowboy

🀠 A Gleam HTTP service adapter for the Cowboy web server
Gleam
53
star
12

tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
JavaScript
52
star
13

gleam-mode

πŸ™ Gleam support for Emacs
Emacs Lisp
48
star
14

erlang

πŸ™ Extra code for when running on Erlang
Gleam
47
star
15

language-tour

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

httpc

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

elli

πŸ› A Gleam HTTP service adapter for the Elli web server
Gleam
44
star
18

json

πŸ‘ Work with JSON in Gleam!
Gleam
43
star
19

packages

πŸ“¦ Search for Gleam packages
Gleam
41
star
20

example-lisp-interpreter

πŸ‘Ύ A Lisp interpreter in Gleam!
Gleam
31
star
21

plug

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

hackney

πŸͺ Make requests to HTTP servers with Hackney
Gleam
29
star
23

javascript

🌼 Extra code for when running on JavaScript
Gleam
29
star
24

fetch

πŸ“‘ Make requests to HTTP servers with fetch
Gleam
27
star
25

suggestions

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

crypto

⛓️ Crypto functionality for Gleam applications
Gleam
24
star
27

template-gleam-javascript

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

setup-erlang

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

hexpm-rust

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

setup-gleam

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

rebar_gleam

🧰 Build Gleam code with rebar3
Erlang
15
star
32

bitwise

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

developer-survey

πŸ—Ί Learning about the Gleam community
Gleam
10
star
34

gleam-highlight.js

🎨 Gleam syntax highlighting with Highlight.js
JavaScript
9
star
35

gleam-v0.17-example

JavaScript
7
star
36

branding

7
star
37

exercism-gleam

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

gleam-compiler-ci-test

Rust
5
star
39

should_assertions

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

package-interface

πŸ“¦ Work with Gleam's package interfaces
Gleam
4
star
41

.github

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

hexpm

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

playground

Gleam
1
star