• Method decorator to describe the expected request payload

    Example

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

    @RequestBody('application/json', 'User information for new user record', true)
    @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

    • contentType: string

      content type of payload i.e. "application/json"

    • Optional description: string

      description of the payload for OpenAPI documentation

    • Optional required: boolean

      indicate if the payload is required

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

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

        • target: T
        • propertyKey: string

        Returns void

Generated using TypeDoc