@grafctory/gate - v0.18.0
    Preparing search index...

    Function worker

    • Serves an asynchronous action as a worker.

      Every request reaching the handler runs the action, whatever its method and content. The action receives the request, so it can qualify the run on its parameters, for instance a query flag forcing a full refresh. The response is sent only once the action settles, so the caller waits for the whole run to complete before learning its outcome.

      A completed action is acknowledged with an empty 200 OK. A rejected action is passed on to the error middleware of the surrounding stack, which is then responsible for the error response and the status code it carries.

      The handler performs no authentication of its own. Access control is left to the surrounding stack.

      Parameters

      • handler: (request: Request) => Promise<unknown>

        The action to run on each request, called with the request that triggered it. Its result is discarded.

      Returns RequestHandler

      A handler running the action on every request it receives, to be mounted on a dedicated route