You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/hydro/handler/notfound.js

20 lines
635 B
JavaScript

const { Route, Handler } = require('../service/server');
const { NotFoundError } = require('../error');
class NotFoundHandler extends Handler {
async prepare() {
throw new NotFoundError(); // eslint-disable-line class-methods-use-this
}
}
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,
};