mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
优化结构
This commit is contained in:
1 parent
75ebc1a746
commit
2554cf660a
34 files changed
+401
-150
No files matched your search
@@ -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,
|
||||
};
|
||||
Reference in new issue
Block a user