Options
All
  • Public
  • Public/Protected
  • All
Menu

@charaverse/express-utils

Index

Type aliases

Middleware: RequestHandler | ErrorRequestHandler
TestServer: Hapi.Server
TestServerInjectOptions: Hapi.ServerInjectOptions
TestServerInjectResponse: Hapi.ServerInjectResponse

Functions

  • Given a list of middlewares, create an app with the middlewares and inject with a request. The returned object is a ServerInjectResponse that

    By default the request url is /.

    Parameters

    • middlewares: Middleware[]

      A list of middlewares to be added into the app.

    • injectRequest: Partial<ServerInjectOptions> = {}

      The request to be injected.

    Returns Promise<TestServerInjectResponse>

  • Given a list of middlewares, create a hapi Server instance with the express middlewares mounted. The resulting server then can be injected with different requests each time.

    Parameters

    • Rest ...middlewares: Middleware[]

      A list of middlewares to be added into the server.

    Returns Promise<TestServer>

  • handle<T>(fn: HandleFunction<T>): RequestHandler
  • Type parameters

    • T = void

    Parameters

    • fn: HandleFunction<T>

    Returns RequestHandler

Generated using TypeDoc