Options
All
  • Public
  • Public/Protected
  • All
Menu

Akera REST Middleware

Index

Type aliases

APIHandler

An API catalog service can be an API handler or a Web handler.

Functions

api

  • api(config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>, logger?: AkeraLogger): express.Router
  • This function creates an akera.io REST API middleware that can be used on an Express application to expose all business logic to be dynamically executed. The catalog middleware can be used instead for more control over what services are exposed.

    If the Web Handler is already used then best to share the same instance, that way the connections are re-used between the services.

    Parameters

    • config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>

      Can be either an instance of @akera/web or one or more broker configuration(s) for remote brokers.

    • Optional logger: AkeraLogger

      An instance of @akera/api logger to be used by the router for logging.

    Returns express.Router

catalog

  • catalog(config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>, catalog: IAPICatalog, logger?: AkeraLogger): express.Router
  • This function creates an akera.io REST API middleware based on a business logic catalog that can be used on an Express application. The api middleware can be used instead for exposing all business logic that can be dynamically executed.

    If the Web Handler is already used then best to share the same instance, that way the connections are re-used between the services.

    Parameters

    • config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>

      Can be either an instance of @akera/web or one or more broker configuration(s) for remote brokers.

    • catalog: IAPICatalog

      The business logic catalog definition.

    • Optional logger: AkeraLogger

      An instance of @akera/api logger to be used by the router for logging.

    Returns express.Router

crud

  • crud(config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>, logger?: AkeraLogger): express.Router
  • This function creates an akera.io REST data access (CRUD) middleware that can be used on an Express application.

    If the Web Handler is already used then best to share the same instance, that way the connections are re-used between the services.

    Parameters

    • config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>

      Can be either an instance of @akera/web or one or more broker configuration(s) for remote brokers.

    • Optional logger: AkeraLogger

      An instance of @akera/api logger to be used by the router for logging.

    Returns express.Router

jsdo

  • jsdo(config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>, asDataset?: boolean, sqlSafe?: boolean, logger?: AkeraLogger): express.Router
  • This function creates an akera.io JSDO data access (CRUD) middleware that can be used on an Express application.

    If the Web Handler is already used then best to share the same instance, that way the connections are re-used between the services.

    Parameters

    • config: AkeraWeb | IBrokerConfig | Array<IBrokerConfig>

      Can be either an instance of @akera/web or one or more broker configuration(s) for remote brokers.

    • Default value asDataset: boolean = true

      Export data in a dataset format, if false single table format is being used (defaults to true).

    • Default value sqlSafe: boolean = false

      If set to true the field names are translated to be valid SQL (defaults to false).

    • Optional logger: AkeraLogger

      An instance of @akera/api logger to be used by the router for logging.

    Returns express.Router