Deno.ServeOptions

Options which can be set when calling Deno.serve.

interface ServeOptions {
hostname?: string;
onError?: (error: unknown) => Response | Promise<Response>;
onListen?: (params: {
hostname: string;
port: number;
}
) => void
;
port?: number;
reusePort?: boolean;
signal?: AbortSignal;
}

§Properties

§
hostname?: string
[src]

A literal IP address or host name that can be resolved to an IP address.

Note about 0.0.0.0 While listening 0.0.0.0 works on all platforms, the browsers on Windows don't work with the address 0.0.0.0. You should show the message like server running on localhost:8080 instead of server running on 0.0.0.0:8080 if your program supports Windows.

§
onError?: (error: unknown) => Response | Promise<Response>
[src]

The handler to invoke when route handlers throw an error.

§
onListen?: (params: {
hostname: string;
port: number;
}
) => void
[src]

The callback which is called when the server starts listening.

§
port?: number
[src]

The port to listen on.

§
reusePort?: boolean
[src]

Sets SO_REUSEPORT on POSIX systems.

§

An AbortSignal to close the server and all connections.