Skip to content

Commit

Permalink
Update HTTP Service Example
Browse files Browse the repository at this point in the history
- update import type syntax
- use bytes_builder over bit_builder
  • Loading branch information
weizhliu authored and lpil committed Feb 12, 2024
1 parent 576c249 commit 195833b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Types and functions for HTTP clients and servers!

```gleam
import gleam/http/elli
import gleam/http/response.{Response}
import gleam/http/request.{Request}
import gleam/bit_builder.{BitBuilder}
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(BitBuilder) {
let body = bit_builder.from_string("Hello, world!")
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")
Expand Down

0 comments on commit 195833b

Please sign in to comment.