mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
20 lines
635 B
JavaScript
20 lines
635 B
JavaScript
const { Route, Handler } = require('../service/server');
|
|
const { NotFoundError } = require('../error');
|
|
|
|
class NotFoundHandler extends Handler {
|
|
async prepare() { // eslint-disable-line class-methods-use-this
|
|
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,
|
|
};
|