Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "RouteSchema"

Index

Interfaces

Functions

Functions

RouteSchema

  • RouteSchema<M>(path: string, methods: M): RouteSchema<M>
  • Defines a route schema, i.e. a path on the server with type information on request data and response data for every supported HTTP method.

    Example

    const TestRouteSchema = RouteSchema('/test', {
      get: MethodSchema<
        RequestData<{
          query: { name: string }
        }>,
        ResponseData<{
          body: { message: string }
        }>
      >()
    })

    Type parameters

    Parameters

    • path: string

      The path of the route.

    • methods: M

      Defines supported HTTP methods on the given path and type information on request and response data.

    Returns RouteSchema<M>

Generated using TypeDoc