1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

docs(serve): fix default Deno.serve hostname (#25392)

Update the docs for `Deno.serve` to reflect that the default hostname is
`0.0.0.0`, not `127.0.0.1`.
This commit is contained in:
Caleb Cox 2024-09-03 10:53:42 -05:00 committed by GitHub
parent 1d04c84c8f
commit 203428ea14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6234,14 +6234,14 @@ declare namespace Deno {
/** Serves HTTP requests with the given option bag and handler.
*
* You can specify an object with a port and hostname option, which is the
* address to listen on. The default is port `8000` on hostname `"127.0.0.1"`.
* address to listen on. The default is port `8000` on hostname `"0.0.0.0"`.
*
* You can change the address to listen on using the `hostname` and `port`
* options. The below example serves on port `3000` and hostname `"0.0.0.0"`.
* options. The below example serves on port `3000` and hostname `"127.0.0.1"`.
*
* ```ts
* Deno.serve(
* { port: 3000, hostname: "0.0.0.0" },
* { port: 3000, hostname: "127.0.0.1" },
* (_req) => new Response("Hello, world")
* );
* ```
@ -6323,14 +6323,14 @@ declare namespace Deno {
/** Serves HTTP requests with the given option bag.
*
* You can specify an object with a port and hostname option, which is the
* address to listen on. The default is port `8000` on hostname `"127.0.0.1"`.
* address to listen on. The default is port `8000` on hostname `"0.0.0.0"`.
*
* ```ts
* const ac = new AbortController();
*
* const server = Deno.serve({
* port: 3000,
* hostname: "0.0.0.0",
* hostname: "127.0.0.1",
* handler: (_req) => new Response("Hello, world"),
* signal: ac.signal,
* onListen({ port, hostname }) {