Replace old docs with new docs repo (#24201)

This commit is contained in:
Lydia Hallie
2025-11-05 11:14:21 -08:00
committed by GitHub
parent 550522e99b
commit 1606a9f24e
407 changed files with 21970 additions and 17527 deletions

28
docs/guides/http/hot.mdx Normal file
View File

@@ -0,0 +1,28 @@
---
title: Hot reload an HTTP server
sidebarTitle: Hot reload an HTTP server
mode: center
---
Bun supports the [`--hot`](https://bun.com/docs/runtime/hot#hot-mode) flag to run a file with hot reloading enabled. When any module or file changes, Bun re-runs the file.
```sh terminal icon="terminal"
bun --hot run index.ts
```
---
Bun detects when you are running an HTTP server with `Bun.serve()`. It reloads your fetch handler when source files change, _without_ restarting the `bun` process. This makes hot reloads nearly instantaneous.
<Note>
Note that this doesn't reload the page on your browser.
</Note>
```ts index.ts icon="/icons/typescript.svg"
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello world");
},
});
```