Files
weiguang-jewelry-ledger/新账系统/server/http.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
428 B
JavaScript
Raw Normal View History

'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 };