Skip to main content

Interface: ServeOptions

Options for configuring the HTTP server.

Properties​

fetch​

fetch: FetchHandler

Handler function called for each incoming HTTP request.


http3?​

optional http3?: boolean

If true, also serve HTTP/3 over QUIC (UDP) on the same port and advertise it to HTTP/1.1 and HTTP/2 clients with an Alt-Svc response header. Requires tls (QUIC is always TLS 1.3). With port: 0, if the UDP side of the auto-assigned port can't be bound, the server picks another port so TCP and UDP still share one port. Defaults to false.


listenIp?​

optional listenIp?: string

IP address to bind to. Defaults to '0.0.0.0'.


port?​

optional port?: number

Port to listen on. Defaults to 0 (random available port).


tls?​

optional tls?: TlsOptions

TLS options for enabling HTTPS. When provided, the server listens for HTTPS connections.


websocket?​

optional websocket?: WebSocketHandlers

Optional WebSocket event handlers for upgraded connections.