'use strict'; const { fail } = require('../core/ledger'); const send = (res, status, data, contentType = 'application/json; charset=utf-8') => { res.writeHead(status, { 'Content-Type': contentType }); res.end(contentType.startsWith('application/json') ? JSON.stringify(data) : data); }; const notFound = () => fail('地址不存在', 404); const HTML = 'text/html; charset=utf-8'; module.exports = { send, notFound, HTML };