Classes
Used to construct an HTTP server.
- addrs(): Deno.Addr[]
Get the list of network addresses the server is listening on.
- close(): void
Immediately close the server listeners and associated HTTP connections.
- closed(): boolean
Get whether the server is closed.
- listenAndServe(): Promise<void>
Create a listener on the server, accept incoming connections, and handle requests on these connections with the given handler.
- listenAndServeTls(): Promise<void>certFile: string,keyFile: string
Create a listener on the server, accept incoming connections, upgrade them to TLS, and handle requests on these connections with the given handler.
- serve(listener: Deno.Listener): Promise<void>
Accept incoming connections on the given listener, and handle requests on these connections with the given handler.
Functions
Serves HTTP requests with the given handler.
Constructs a server, accepts incoming connections on the given listener, and handles requests on these connections with the given handler.
Serves HTTPS requests with the given handler.
Interfaces
Information about the connection a request arrived on.
- localAddr: Deno.Addr
The local address of the connection.
- remoteAddr: Deno.Addr
The remote address of the connection.
Additional serve options.
- onError: (error: unknown) => Response | Promise<Response>
The handler to invoke when route handlers throw an error.
- onListen: (params: { hostname: string; port: number; }) => void
The callback which is called when the server started listening
- signal: AbortSignal
An AbortSignal to close the server and all connections.
Additional serve listener options.
- onError: (error: unknown) => Response | Promise<Response>
The handler to invoke when route handlers throw an error.
- onListen: (params: { hostname: string; port: number; }) => void
The callback which is called when the server started listening
- signal: AbortSignal
An AbortSignal to close the server and all connections.
Options for running an HTTP server.
Type Aliases
A handler for HTTP requests. Consumes a request and connection information and returns a response.