Setu-TS
    Preparing search index...

    Interface BunServeHost

    Minimal interface covering the Bun-specific HTTP operations used by this adapter. Inject this interface to test the adapter without real Bun.

    interface BunServeHost {
        serve(
            options: {
                fetch: (
                    request: Request,
                    server: BunServer,
                ) => Response | Promise<Response | undefined> | undefined;
                hostname?: string;
                port: number;
                websocket?: BunWebSocketHandlers;
            },
        ): BunServer;
    }
    Index
    • Starts an HTTP server.

      The fetch callback receives the BunServer as its second argument (Bun's own signature) because server.upgrade() is the only way to perform a WebSocket handshake, and it may resolve undefined to tell Bun that the request was upgraded and needs no response.

      Parameters

      • options: {
            fetch: (
                request: Request,
                server: BunServer,
            ) => Response | Promise<Response | undefined> | undefined;
            hostname?: string;
            port: number;
            websocket?: BunWebSocketHandlers;
        }

        Server options

      Returns BunServer

      The server handle