aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-08-24 23:05:27 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-08-24 23:05:27 -0700
commit90f3bf2796b08f38297321c46366ed417b1ecb3b (patch)
treedcbd498d889c8fd8321dec48888fcf4df162917b /docs
parent16b4bf341acc0f4804f0b6bdf5298c180cd00366 (diff)
downloadbun-90f3bf2796b08f38297321c46366ed417b1ecb3b.tar.gz
bun-90f3bf2796b08f38297321c46366ed417b1ecb3b.tar.zst
bun-90f3bf2796b08f38297321c46366ed417b1ecb3b.zip
Update http.mdbun-v0.8.1
Diffstat (limited to 'docs')
-rw-r--r--docs/api/http.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/api/http.md b/docs/api/http.md
index 8520604e8..1029972a6 100644
--- a/docs/api/http.md
+++ b/docs/api/http.md
@@ -35,7 +35,7 @@ To configure which port and hostname the server will listen on:
```ts
Bun.serve({
- port: 8080, // defaults to $PORT, then 3000
+ port: 8080, // defaults to $BUN_PORT, $PORT, $NODE_PORT otherwise 3000
hostname: "mydomain.com", // defaults to "0.0.0.0"
fetch(req) {
return new Response(`404!`);
@@ -43,6 +43,17 @@ Bun.serve({
});
```
+To listen on a [unix domain socket](https://en.wikipedia.org/wiki/Unix_domain_socket):
+
+```ts
+Bun.serve({
+ unix: "/tmp/my-socket.sock", // path to socket
+ fetch(req) {
+ return new Response(`404!`);
+ },
+});
+```
+
## Error handling
To activate development mode, set `development: true`. By default, development mode is _enabled_ unless `NODE_ENV` is `production`.
@@ -78,7 +89,7 @@ Bun.serve({
```
{% callout %}
-**Note** — Full debugger support is planned.
+[Learn more about debugging in Bun](https://bun.sh/docs/runtime/debugger)
{% /callout %}
The call to `Bun.serve` returns a `Server` object. To stop the server, call the `.stop()` method.