Response
The Response object contains methods for sending a HTTP response to the client.
Methods
header()
header(key: string, value: string): response
This method sets a response HTTP header.
send()
send(status: number, data?: any, contentType?: string): void
This method sends a response to the client.
success()
success(data?: any, contentType?: string)
Sends a response with status code 200.
created()
created(data?: any, contentType?: string)
Sends a response with status code 201.
notFound()
notFound(data?: any, contentType?: string)
Sends a response with status code 404.
badRequest()
badRequest(data?: any, contentType?: string)
Sends a response with status code 400.
unauthorized()
unauthorized(data?: any, contentType?: string)
Sends a response with status code 401.
forbidden()
forbidden(data?: any, contentType?: string)
Sends a response with status code 403.
internalServerError()
internalServerError(data?: any, contentType?: string)
Sends a response with status code 500.