路由表化:新增路由匹配器、中间件与表驱动分发,迁移店铺设置/员工/货盘路由
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b9cb825be
commit
e082069f55
14 files changed
+525
-197
No files matched your search
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
const { fail } = require('../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 };
|
||||
Reference in new issue
Block a user