init datamate

This commit is contained in:
Dallas98
2025-10-21 23:00:48 +08:00
commit 1c97afed7d
692 changed files with 135442 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
const sendJSON = (req, res, next) => {
res.sendJSON = (
data = null,
{ code = '0', msg = 'success', statusCode = 200, timeout = 0 } = {}
) => {
const timer = setTimeout(() => {
res.status(statusCode).json({
code,
msg,
data,
});
clearTimeout(timer);
}, timeout);
};
next();
};
module.exports = sendJSON;