Options
All
  • Public
  • Public/Protected
  • All
Menu

A response object.

Hierarchy

  • Stoof

Index

Constructors

Methods

Constructors

constructor

  • new Stoof(code: number, body: string): Stoof
  • new Stoof(body: string): Stoof
  • Creates a new Stoof instance.

    Parameters

    • code: number

      The HTTP status code to respond with.

    • body: string

      The body of the response.

    Returns Stoof

  • Creates a new Stoof instance with HTTP status code 200.

    Parameters

    • body: string

      The body of the response.

    Returns Stoof

Methods

cookie

  • cookie(key: string, value: string, maxAge?: undefined | number, path?: undefined | string): Stoof
  • Defines a cookie value to be set in the response.

    Parameters

    • key: string

      The key associated with the value.

    • value: string

      The cookie value.

    • Optional maxAge: undefined | number

      The max time for the cookie to persist, in milliseconds.

    • Optional path: undefined | string

      The cookie value's path.

    Returns Stoof

    This Stoof instance, for the sake of chaining.

header

  • header(key: string, value: string): Stoof
  • Sets a header to be sent with the response.

    Parameters

    • key: string

      The header name.

    • value: string

      The header value.

    Returns Stoof

    This Stoof instance, for the sake of chaining.

uncookie

  • uncookie(key: string, path?: undefined | string): Stoof
  • Defines a cookie value to be unset in the response.

    Parameters

    • key: string

      The key associated with the cookie value.

    • Optional path: undefined | string

      The cookie value's path.

    Returns Stoof

    This Stoof instance, for the sake of chaining.

Generated using TypeDoc