Module: utils/writer

Some helper functions/utilities for replying back from API call.
Author:
License:
  • MIT
Source:

Methods

(inner) writeJson(response, arg1, arg2)

prepare JSON reply

Reply with content and numeric code into response object.
Parameters:
Name Type Description
response object Object for response
arg1 object Reply content, either string or JSON
arg2 number Reply code, numeric HTTP value
Source:

(inner) writeText(response, payload, code)

prepare text reply

Reply with content and numeric code into response object.
Parameters:
Name Type Description
response object Object for response
payload object Reply content, plain string
code number Reply code, numeric HTTP value
Source: