Skip to content

Commit 577cb6d

Browse files
committed
doc(example): update existing examples handler functions
1 parent d6c4644 commit 577cb6d

File tree

10 files changed

+19
-10
lines changed

10 files changed

+19
-10
lines changed

examples/01-routing/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/02-working-with-form-data/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/03-working-with-json/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/04-working-with-other-formats/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/05-using-a-database/src/app.gleam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn main() {
2424
let handler = router.handle_request(_, context)
2525

2626
let assert Ok(_) =
27-
handler
27+
fn(req, _) { handler(req) }
2828
|> wisp_mist.handler(secret_key_base)
2929
|> mist.new
3030
|> mist.port(8000)

examples/06-serving-static-assets/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ pub fn main() {
1717
let handler = router.handle_request(_, ctx)
1818

1919
let assert Ok(_) =
20-
wisp_mist.handler(handler, secret_key_base)
20+
fn(req, _) { handler(req) }
21+
|> wisp_mist.handler(secret_key_base)
2122
|> mist.new
2223
|> mist.port(8000)
2324
|> mist.start_http

examples/07-logging/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/08-working-with-cookies/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/09-configuring-default-responses/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

examples/10-working-with-files/src/app.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn main() {
99
let secret_key_base = wisp.random_string(64)
1010

1111
let assert Ok(_) =
12-
wisp_mist.handler(router.handle_request, secret_key_base)
12+
fn(req, _) { router.handle_request(req) }
13+
|> wisp_mist.handler(secret_key_base)
1314
|> mist.new
1415
|> mist.port(8000)
1516
|> mist.start_http

0 commit comments

Comments
 (0)