aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.