Function res

  • Builds a JSON Response using Apiker's per-request response headers.

    The payload is normalized (strings/numbers become { message }) and pretty-printed with 4-space indentation when apiker.debug is enabled.

    Parameters

    • input: any

      Response payload — a string, number, or object.

    • options: any = ...

      Either a numeric HTTP status code, or a ResponseInit object that is merged into the response (status defaults to 200).

    Returns Response

    A Response with a JSON body and the configured headers.

    Example

    return res({ id: user.id }, 201);
    

Generated using TypeDoc