Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Response

Responsible for provide a set of methods to response to a http request

Hierarchy

  • Response

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Response(outcoming: ServerResponse): Response
  • Instanciates a new Response

    Parameters

    • outcoming: ServerResponse

      http response

    Returns Response

Properties

Private _outcoming

_outcoming: ServerResponse

Methods

send

  • send(content: any, code?: number, contentType?: string, headers?: {}): void
  • Produces an http response based on provided params.

    Parameters

    • content: any

      content of the response.

    • code: number = 200

      http code.

    • contentType: string = "application/json"

      http content-type header

    • Optional headers: {}

      http headers

      • [key: string]: string

    Returns void

setHeader

  • setHeader(key: string, val: string): void
  • Writes http header to the http response buffer.

    Parameters

    • key: string

      http header key

    • val: string

      http header val

    Returns void

Generated using TypeDoc