Module: utils/expressUtils

Provides Express related functions that are used common.

Source:

Methods

(static) responseAuthError(res, message)

Responds with HTTP 401 with the given message.

Parameters:
Name Type Description
res Response

response

message string

message to send

Source:

(static) responseInvalidRequestError(res, message)

Responds with HTTP 400 with the given message.

Parameters:
Name Type Description
res Response

response

message string

message to send

Source:

(static) responseOK(res)

Responds with {"OK": 1};

Parameters:
Name Type Description
res Response

response

Source:

(static) responseOKHandler(res) → {function}

Returns a higher order function to pass promise chains. Calls module:utils/expressUtils.responseOK

Parameters:
Name Type Description
res Response

response

Source:
Returns:

higher order function

Type
function

(static) responseServerErrorHandler(res) → {function}

Returns a higher order function to pass promise chains. Returned function responds with HTTP 500 with a generic message. We don't want to tell user too much in case of some server error.

Parameters:
Name Type Description
res Response

response

Source:
Returns:

higher order function

Type
function