import { type DummyJsonRoutes } from "./routes.js"; /** Options accepted by {@link useBunCreate}. */ export interface BunServerOptions { /** Port to listen on (default `3000`). */ port?: string | number; /** Hostname to bind to (default `"localhost"`). */ hostname?: string; /** Route table (defaults to {@link useBuildDummyJsonRoutes}). */ routes?: DummyJsonRoutes; /** Optional fallback handler for unmatched routes. */ fetch?: (req: Request, server: Bun.Server) => Response | Promise; } /** * Creates (or returns the existing) Bun HTTP server with the dummyjson route * table. Idempotent — subsequent calls return the same server. * * Requires the Bun runtime (Bun v1.2.3+ for the `routes` API). * * @param options - Optional port, hostname, routes and fetch handler. * @returns The running {@link Bun.Server}. * * @example * ```ts * import { dummyJsonApiConfig, useBunCreate } from "katanakit-js/adapters/bun"; * import { defineApiConfig } from "katanakit-js"; * * defineApiConfig(dummyJsonApiConfig); * const server = useBunCreate({ port: 3000 }); * console.log(`Server running at ${server.url}`); * ``` */ export declare function useBunCreate(options?: BunServerOptions): Bun.Server; /** * Starts the Bun server on the given port/hostname (Singleton). * * @param port - Port to listen on (default `3000`). * @param hostname - Hostname to bind to (default `"localhost"`). * @returns The running {@link Bun.Server}. */ export declare function useBunStart(port?: string | number, hostname?: string): Bun.Server; /** * Returns the current Bun server singleton, or `null` before {@link useBunCreate}. * * @returns The {@link Bun.Server} or `null`. */ export declare function useBunGetServer(): Bun.Server | null; /** * Stops the Bun server and clears the singleton. * * @param closeActiveConnections - Immediately terminate in-flight requests. * @returns A promise that resolves once all connections are closed. */ export declare function useBunStop(closeActiveConnections?: boolean): Promise; //# sourceMappingURL=server.d.ts.map