Base HTTP server class for Wings - NOT meant for direct use. This is a lightweight, fast base class with zero dependencies and strong test coverage. For development, use DevServer. For production, use ClusteredServer. Only extend this class when building custom server implementations.

Hierarchy (view full)

Constructors

Accessors

  • get server(): Server<typeof IncomingMessage, typeof ServerResponse>
  • Get underlying HTTP server instance.

    Returns Server<typeof IncomingMessage, typeof ServerResponse>

    Node.js HTTP server

Methods

  • Gracefully close server.

    Returns Promise<void>

    Resolves when closed

    When already closed or network errors occur

  • Protected

    Handle request processing errors.

    Parameters

    • err: Error

      Error that occurred

    • req: IncomingMessage

      Original request

    • res: ServerResponse<IncomingMessage>

      Response object

    Returns void

  • Start server listening on port.

    Parameters

    • port: number

      Port to listen on (0 for auto-assign)

    • Optionalhost: string = "localhost"

      Host to bind to (default: 'localhost')

    • Optionalcallback: (() => void) = ...

      Optional callback

        • (): void
        • Returns void

    Returns Promise<void>

    Resolves when listening

    When port is in use or requires privileges

  • Protected

    Convert Wings Context to HTTP response.

    Parameters

    • context: Context

      Wings context with response data

    • res: ServerResponse<IncomingMessage>

      HTTP response object

    Returns void