aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-16 19:28:29 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-16 19:28:29 -0700
commitd0ca9f24999ebf5325ceb51670028f4064de3cf7 (patch)
tree8c35f02a3519546ae139d6cd55d54b3e5a29a5ee
parent95daafee0fd6a315da38b1ce48944f37dd2e905d (diff)
downloadbun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.tar.gz
bun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.tar.zst
bun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.zip
Update README.md
Diffstat (limited to '')
-rw-r--r--README.md12
1 files changed, 11 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9b36560e1..2a40c6f7a 100644
--- a/README.md
+++ b/README.md
@@ -1565,7 +1565,17 @@ Bun.serve({
**If the `error` function itself throws and `development` is `false`, a generic 500 page will be shown**
-Currently, there is no way to stop the HTTP server once started 😅, but that will be added in a future version.
+To stop the server, call `server.stop()`:
+
+```ts
+const server = Bun.serve({
+ fetch() {
+ return new Response("HI!");
+ },
+});
+
+server.stop();
+```
The interface for `Bun.serve` is based on what [Cloudflare Workers](https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/#module-workers-in-the-dashboard) does.