jimpex
    Preparing search index...

    Class GatewayController

    A utility controller that generates routes that act as a gateway for a specific API.

    Index

    Constructors

    Properties

    _apiConfigEndpoints: EndpointsDict

    The generated endpoints for the API client configuration the controller can generate.

    _apiConfigUrl: string

    The entry URL for the API client configuration the controller can generate.

    _endpoints: Record<string, GatewayConfigEndpointDefinition>

    A flat dictionary with the endpoints information.

    _gatewayConfig: GatewayConfig

    The information, url and endpoints, for the gateway the controller will make requests to.

    _getHelperService: () => | Partial<
        {
            handleEndpointError: GatewayHelperServiceErrorHandler;
            handleEndpointResponse: GatewayHelperServiceResponseHandler;
            reduceEndpointRequest: GatewayHelperServiceRequestReducer;
            reduceEndpointResponse: GatewayHelperServiceResponseReducer;
            shouldStreamEndpointResponse: GatewayHelperServiceStreamVerification;
        },
    >
    | undefined

    A function to get a possible helper service. This is injected as a "getter" to not interrupt the DIC "lifecycle": controllers are initialized right when the app starts, and injecting a reference would force the service to be initialized too, even if a request is not being made.

    The controller customization options.

    _route: string

    The route in which the controller is mounted.

    _routeExpression: RegExp

    A regular expression that will be used to remove the controller route from a request path. This will allow the main middleware to extract the path to where the request should be made.

    The list of routes the controller can handle.

    http: HTTP

    The service that makes HTTP requests.

    Accessors

    Methods

    • Mounts the middlewares in the router in order to make the requests.

      Parameters

      • router: Router

        A reference to the application router.

      • middlewares: ExpressMiddleware[] = []

        A list of extra middlewares to execute before the gateway middleware.

      Returns Router