Skip to content

Commit

Permalink
Update http.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed May 6, 2024
1 parent bafa32b commit 34c5d08
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions docs/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ Bun.serve({
});
```

Optionally, you can also access the `Server` object from the `fetch` handler.
You can also access the `Server` object from the `fetch` handler. It's the second argument passed to the `fetch` function.

```ts
// `server` is passed in as the second argument to `fetch`.
const server = Bun.serve({
fetch(req, server) {
const ip = server.requestIP(req);

return new Response(`Your IP is ${ip}`);
},
});
Expand Down

0 comments on commit 34c5d08

Please sign in to comment.