All Projects → gleam-lang → cowboy

gleam-lang / cowboy

Licence: Apache-2.0 license
🤠 A Gleam HTTP service adapter for the Cowboy web server

Programming Languages

Gleam
7 projects
erlang
1774 projects

Labels

Projects that are alternatives of or similar to cowboy

gleam-mode
🐙 Gleam support for Emacs
Stars: ✭ 30 (+25%)
Mutual labels:  gleam
mix gleam
⚗️ Build Gleam code with mix
Stars: ✭ 84 (+250%)
Mutual labels:  gleam
gleam decode
Transform Erlang or Elixir data into Gleam data
Stars: ✭ 25 (+4.17%)
Mutual labels:  gleam
stdlib
🎁 Gleam's standard library
Stars: ✭ 153 (+537.5%)
Mutual labels:  gleam
otp
📫 Fault tolerant multicore programs with actors
Stars: ✭ 169 (+604.17%)
Mutual labels:  gleam
website
🏡 Gleam's website and guide
Stars: ✭ 35 (+45.83%)
Mutual labels:  gleam
plug
🔌 A Gleam HTTP service adapter for the Plug web application interface
Stars: ✭ 25 (+4.17%)
Mutual labels:  gleam
template-gleam-javascript
🧃 A template for trying out Gleam compiled to JavaScript
Stars: ✭ 22 (-8.33%)
Mutual labels:  gleam
Gleam
⭐️ A friendly language for building type-safe, scalable systems!
Stars: ✭ 3,463 (+14329.17%)
Mutual labels:  gleam
setup-gleam
👷‍♀️ Gleam on GitHub Actions
Stars: ✭ 16 (-33.33%)
Mutual labels:  gleam
vscode-gleam
📟 Gleam support for VS Code
Stars: ✭ 34 (+41.67%)
Mutual labels:  gleam
Synapses
A group of neural-network libraries for functional and mainstream languages
Stars: ✭ 63 (+162.5%)
Mutual labels:  gleam
example-echo-server
🔗 An example Gleam web application
Stars: ✭ 59 (+145.83%)
Mutual labels:  gleam
gleam compile
Tiny hex package to make the development experience of using gleam in elixir (and especially phoenix projects) better.
Stars: ✭ 29 (+20.83%)
Mutual labels:  gleam

Gleam Cowboy! 🤠

A Gleam HTTP service adapter for the Cowboy web server.

import gleam/erlang
import gleam/http/cowboy
import gleam/http/response.{Response}
import gleam/http/request.{Request}
import gleam/bit_builder.{BitBuilder}

// Define a HTTP service
//
pub fn my_service(request: Request(t)) -> Response(BitBuilder) {
  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() {
  cowboy.start(my_service, on_port: 3000)
  erlang.sleep_forever()
}

Limitations

Cowboy does not support duplicate HTTP headers so any duplicates specified by the Gleam HTTP service will not be sent to the client.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].