Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ApiResponse<T>

A generic rest API response. Used in Express controllers

Type parameters

  • T

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • Creates a generic type T instance object

    Parameters

    • Optional item: Partial<ApiResponse>

      The item to assign to this instance

    Returns ApiResponse

Properties

Optional clone

clone: function

Return a clone with JSON.parse(JSON.stringify(this))

Type declaration

    • (): any
    • Returns any

data

data: T

The result data

exception

exception: any

The exception, populated when isOk() === false

httpCode

httpCode: number

The response HTTP code

isOk

isOk: boolean

Indicates if the response is valid

response

response: Response

The response stream

Methods

Private extract

  • extract(): ApiResponseDto<T>

send

  • send(): void

Generated using TypeDoc