Interface ServeOptions

Server options

interface ServeOptions {
    hostname?: string;
    onError?: ((error) => void);
    onListen?: ((params) => void);
    port?: number;
    signal?: AbortSignal;
}

Hierarchy (view full)

Properties

hostname?: string

Hostname or IP address or interface to listen on

Default Value

"localhost"
onError?: ((error) => void)

Called when an unhandled error occurs

Type declaration

    • (error): void
    • Called when an unhandled error occurs

      Parameters

      • error: unknown

        Unhandled error

      Returns void

      Default Value

      console.error
      

Default Value

console.error

Param: error

Unhandled error

onListen?: ((params) => void)

Called once the server starts listening for requests

Type declaration

    • (params): void
    • Called once the server starts listening for requests

      Parameters

      • params: {
            address: string;
            port: number;
        }

        Server network information

        • address: string

          Server IP address

        • port: number

          Server port

      Returns void

Param: params

Server network information

port?: number

Port to listen on

Default Value

0
signal?: AbortSignal

Signal usable to shutdown the server

Generated using TypeDoc