'use strict'; function ok(res, data) { res.status(200).json({ data }); } function created(res, data) { res.status(201).json({ data }); } function collection(res, data, total, page, limit) { res.status(200).json({ data, meta: { total, page, limit, totalPages: Math.ceil(total / limit), }, }); } function noContent(res) { res.status(204).end(); } function err(res, code, message, status, field) { res.status(status).json({ error: { code, message, ...(field ? { field } : {}) }, }); } module.exports = { ok, created, collection, noContent, err };