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/packages/hydrooj/src/handler/notfound.ts

26 lines
844 B
TypeScript

/* eslint-disable no-empty-function */
/* eslint-disable class-methods-use-this */
import { NotFoundError } from '../error';
import { Route, Handler } from '../service/server';
5 years ago
class NotFoundHandler extends Handler {
prepare() {
throw new NotFoundError(this.request.path);
5 years ago
}
all() { }
5 years ago
}
export async function apply() {
Route('notfound', '/:a', NotFoundHandler);
Route('notfound', '/:a/:b', NotFoundHandler);
Route('notfound', '/:a/:b/:c', NotFoundHandler);
Route('notfound', '/:a/:b/:c/:d', NotFoundHandler);
Route('notfound', '/:a/:b/:c/:d/:e', NotFoundHandler);
Route('notfound', '/:a/:b/:c/:d/:e/:f', NotFoundHandler);
Route('notfound', '/:a/:b/:c/:d/:e/:f/:g', NotFoundHandler);
Route('notfound', '/:a/:b/:c/:d/:e/:f/:g/:h', NotFoundHandler);
5 years ago
}
global.Hydro.handler.notfound = apply;