Class Server

Server that discovers routes using decorators on controller classes and methods. Processing of requests is preformed by the lambda-api package.

Hierarchy

  • Server

Constructors

  • Create a new server.

    Parameters

    • appContainer: Container

      Application container to use to build containers.

    • appConfig: AppConfig

      Application config to pass to lambda-api.

    Returns Server

Accessors

Methods

  • Configure the API instance from the lambda-api package.

    Parameters

    • handler: ((this, api) => void)

      Function that takes an API instance as a parameter.

        • (this, api): void
        • Parameters

          • this: void
          • api: API

          Returns void

    Returns void

  • Scans the specified path for javascript files and loads these into the current runtime. Importing the files will invoke the decorators declared within them. Note: this scans only the top level files.

    API decorators register controllers, endpoints, configuration and middleware. A series of endpoints are built using the decorator components and registered with the lambda-api package routing engine.

    Controllers and error interceptors registered by decorators are built using an IOC container, which allows dependency injection.

    OpenAPI endpoints will be registered here, if they are enabled in the app config by setting the openApi.enabled flag to true.

    This method must be called before invoking the processEvent method.

    Parameters

    • Optional controllersPath: string[]

      (Optional) Paths to the directories that contain controller js files. Dynamic loading of injectable controllers is disabled if undefined or the app Container instance has its autoBindInjectable flag set to false.

    Returns Promise<void>

  • Takes an API request passed in by AWS Lambda and processes it using the lambda-api package.

    Parameters

    • request: ApiRequest

      API Gateway or ALB request.

    • context: any

      Request context.

    Returns Promise<ApiResponse>

    The response.

Generated using TypeDoc