mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -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:
parent
1d04c84c8f
commit
203428ea14
1 changed files with 5 additions and 5 deletions
10
cli/tsc/dts/lib.deno.ns.d.ts
vendored
10
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -6234,14 +6234,14 @@ declare namespace Deno {
|
||||||
/** Serves HTTP requests with the given option bag and handler.
|
/** Serves HTTP requests with the given option bag and handler.
|
||||||
*
|
*
|
||||||
* You can specify an object with a port and hostname option, which is the
|
* 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`
|
* 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
|
* ```ts
|
||||||
* Deno.serve(
|
* Deno.serve(
|
||||||
* { port: 3000, hostname: "0.0.0.0" },
|
* { port: 3000, hostname: "127.0.0.1" },
|
||||||
* (_req) => new Response("Hello, world")
|
* (_req) => new Response("Hello, world")
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
|
@ -6323,14 +6323,14 @@ declare namespace Deno {
|
||||||
/** Serves HTTP requests with the given option bag.
|
/** Serves HTTP requests with the given option bag.
|
||||||
*
|
*
|
||||||
* You can specify an object with a port and hostname option, which is the
|
* 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
|
* ```ts
|
||||||
* const ac = new AbortController();
|
* const ac = new AbortController();
|
||||||
*
|
*
|
||||||
* const server = Deno.serve({
|
* const server = Deno.serve({
|
||||||
* port: 3000,
|
* port: 3000,
|
||||||
* hostname: "0.0.0.0",
|
* hostname: "127.0.0.1",
|
||||||
* handler: (_req) => new Response("Hello, world"),
|
* handler: (_req) => new Response("Hello, world"),
|
||||||
* signal: ac.signal,
|
* signal: ac.signal,
|
||||||
* onListen({ port, hostname }) {
|
* onListen({ port, hostname }) {
|
||||||
|
|
Loading…
Reference in a new issue