aboutsummaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api')
-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.