Type alias Middleware<Meta>

Middleware<Meta>: ((apiContext: ApiContext, meta: Meta) => Promise<boolean>)

Type Parameters

Type declaration

    • (apiContext: ApiContext, meta: Meta): Promise<boolean>
    • Middleware type to be executed immediately before endpoint execution, before the request body is read. It may add to the context (who's calling, say) for the endpoint to read, and refuse the call by throwing an ApiError (or by answering it itself and returning false).

      Returns

      Promise which, if it resolves to false, the endpoint processing does not continue (In that case, the middleware should take care of responding to the client )

      Parameters

      • apiContext: ApiContext

        The context the endpoint will be passed

      • meta: Meta

        The endpoint's metadata

      Returns Promise<boolean>

Generated using TypeDoc