aboutsummaryrefslogtreecommitdiff
path: root/docs/runtime
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-03-07 21:05:37 -0800
committerGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-03-07 21:05:44 -0800
commit95b59ea0ef637abde76dad4a100cae6c496c1470 (patch)
treea3ba1cd677ff935bb44d68066546ccb49085ed83 /docs/runtime
parent24e90726fd88ad8d629b898afe2d35d0fdae0190 (diff)
downloadbun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.gz
bun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.zst
bun-95b59ea0ef637abde76dad4a100cae6c496c1470.zip
Document openInEditor
Diffstat (limited to 'docs/runtime')
-rw-r--r--docs/runtime/hot.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/runtime/hot.md b/docs/runtime/hot.md
index 96571453c..a66534949 100644
--- a/docs/runtime/hot.md
+++ b/docs/runtime/hot.md
@@ -39,6 +39,8 @@ Traditional file watchers like `nodemon` restart the entire process, so HTTP ser
Bun provides the following simplified API for implementing HTTP servers. Refer to [API > HTTP](/docs/api/http) for full details.
```ts#server.ts
+import {type Serve} from "bun";
+
globalThis.count = globalThis.count ?? 0;
globalThis.count++;
@@ -47,7 +49,7 @@ export default {
return new Response(`Reloaded ${globalThis.count} times`);
},
port: 3000,
-};
+} satisfies Serve;
```
The file above is simply exporting an object with a `fetch` handler defined. When this file is executed, Bun interprets this as an HTTP server and passes the exported object into `Bun.serve`.