• Method decorator which describes an HTTP status code that can be returned by this Express route. This decorator can be applied multiple times to a single Express route to describe all status codes produced by this route.

    Example

    @Controller('/api', 'User', 'User Management Routes')
    class User {

    @HttpResponse(201, 'New user record created')
    @HttpResponse(400, 'Missing required data')
    @HttpPost('/user', 'Create a new user')
    async createUser(
    @RequestParam('username') username: string,
    @RequestParam('password') password: string,
    @Response() res: ExpressResponse
    ): Promise<void> {
    ...
    }
    }

    Type Parameters

    • T

      Class method to be registered with the Express application as a route

    Parameters

    • statusCode: number

      HTTP status code

    • description: string

      Description of the scenario in which this HTTP status code will be produced

    • Optional contentType: string
    • Optional example: any

    Returns ((target: T, propertyKey: string) => void)

      • (target: T, propertyKey: string): void
      • Parameters

        • target: T
        • propertyKey: string

        Returns void

Generated using TypeDoc