diff options
author | 2023-03-07 21:05:37 -0800 | |
---|---|---|
committer | 2023-03-07 21:05:44 -0800 | |
commit | 95b59ea0ef637abde76dad4a100cae6c496c1470 (patch) | |
tree | a3ba1cd677ff935bb44d68066546ccb49085ed83 /docs/api/http.md | |
parent | 24e90726fd88ad8d629b898afe2d35d0fdae0190 (diff) | |
download | bun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.gz bun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.zst bun-95b59ea0ef637abde76dad4a100cae6c496c1470.zip |
Document openInEditor
Diffstat (limited to 'docs/api/http.md')
-rw-r--r-- | docs/api/http.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/api/http.md b/docs/api/http.md index 4cb55349a..3e11299dd 100644 --- a/docs/api/http.md +++ b/docs/api/http.md @@ -134,11 +134,13 @@ Bun.serve({ Thus far, the examples on this page have used the explicit `Bun.serve` API. Bun also supports an alternate syntax. ```ts#server.ts +import {type Serve} from "bun"; + export default { fetch(req) { return new Response(`Bun!`); }, -}; +} satisfies Serve; ``` Instead of passing the server options into `Bun.serve`, export it. This file can be executed as-is; when Bun runs a file with a `default` export containing a `fetch` handler, it passes it into `Bun.serve` under the hood. |