Util class for handling API responses.

Example

import createServer from '@egomobile/http-server'
import { ApiResponseBuilder } from '@egomobile/api-utils'

const app = createServer()

app.get('/', async (request, response) => {
new ApiResponseBuilder({ request, response })
.send() // send a simple 200 message
})

app.listen()
.catch(console.error)

Constructors

Properties

_data: Nullable<ApiResponseData> = null
_executeEnd: boolean
_headers: OutgoingHttpHeaders = {}
_messages: IApiResponseMessage[] = []
_status: number = 200
_success: boolean = true
request: IHttpRequest<any>

The underlying request context.

response: IHttpResponse

The underlying response context.

Accessors

Methods

Generated using TypeDoc