Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 44x 41x 44x 42x 44x 5x | "use strict"; /** * Return success status and payload as response. * * @param {Response} res use as res.success(...) * @param {string|object} [message='Success'] success message to return * @param {string} [audit=false] audit event type * @param {string} [extra=undefined] extra audit payload which may help debug event */ function success(res, message = 'Success', audit = false, extra = undefined) { if (audit) { res.audit(audit, message, extra); } if (typeof message === 'string') { message = { success: message }; } res.status(200) .json(message); } module.exports = success; |