优化结构

This commit is contained in:
undefined committed 2020-04-30 18:07:35 +08:00
1 parent 75ebc1a746
commit 2554cf660a
34 files changed
+401 -150

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
const { Route, Handler } = require('../service/server');
const { NotFoundError } = require('../error');
class NotFoundHandler extends Handler {
async prepare() {
throw new NotFoundError();
}
}
async function apply() {
Route('/:param1', module.exports.NotFoundHandler);
Route('/:param1/:param2', module.exports.NotFoundHandler);
Route('/:param1/:param2/:param3', module.exports.NotFoundHandler);
Route('/:param1/:param2/:param3/:param4', module.exports.NotFoundHandler);
}
global.Hydro.handler.notfound = module.exports = {
NotFoundHandler, apply,
};