UNPKG

@tableau/taco-toolkit

Version:
22 lines (21 loc) 982 B
/// <reference types="node" /> import { Server } from 'http'; import { PortManager } from '../modules/port-manager'; type StartServer = (port: number) => Promise<void>; /** * Starts a server with auto-assigned port from PortManager. * * The function will re-try on a different port if the startServer function throws * an error with property code: 'EADDRINUSE', for a maximum of 5 attempts. * * @param startServer An async function responsible for starting the server on a given port * @param portManager The manager responsible for assigning and reserving ports * @returns The port number on which the server is successfully started */ export declare function startServerWithRetry(startServer: StartServer, portManager: PortManager): Promise<number>; /** * Starts an HTTP server on the given port. */ export declare function startHttpServer(server: Server, port: number): Promise<void>; export declare function closeHttpServer(server: Server): Promise<void>; export {};