diff options
author | 2022-05-16 19:28:29 -0700 | |
---|---|---|
committer | 2022-05-16 19:28:29 -0700 | |
commit | d0ca9f24999ebf5325ceb51670028f4064de3cf7 (patch) | |
tree | 8c35f02a3519546ae139d6cd55d54b3e5a29a5ee | |
parent | 95daafee0fd6a315da38b1ce48944f37dd2e905d (diff) | |
download | bun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.tar.gz bun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.tar.zst bun-d0ca9f24999ebf5325ceb51670028f4064de3cf7.zip |
Update README.md
Diffstat (limited to '')
-rw-r--r-- | README.md | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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. |