Fake Mirrors
    Preparing search index...

    Class NativeHttpServer

    Native-based http-server implementation.

    This server uses native Node.js http and WebSocket ws modules to handle HTTP requests and WebSocket connections.

    Depends:

    import { DIContainer } from '@famir/common'
    import { NativeHttpServer } from '@famir/http-server'

    // Get container singleton
    const container = DIContainer.getInstance()

    // Register in DI container
    NativeHttpServer.register(container)
    import { DIContainer } from '@famir/common'
    import { HTTP_SERVER, HttpServer } from '@famir/domain'

    // Get container singleton
    const container = DIContainer.getInstance()

    // Resolve from DI container
    const httpServer = container.resolve<HttpServer>(HTTP_SERVER)

    // Start HTTP and WebSocket server
    await httpServer.start()

    // Stop server
    await httpServer.stop()

    Implements

    • Starts the server and begins accepting connections.

      Returns Promise<void>

      LifecycleError If the server cannot be started.

    • Stops the server and closes all active connections.

      Returns Promise<void>

      LifecycleError If the server cannot be stopped.

    • Registers the http-server as a singleton in the DI container.

      Parameters

      • container: DIContainer

        The DI container to register in.

      Returns void