Render error pages as HTML

This commit is contained in:
2024-10-22 12:49:14 +02:00
parent ea58c1f60b
commit ba7336b4ee
9 changed files with 53 additions and 38 deletions

10
handlers/not-found.ts Normal file
View File

@@ -0,0 +1,10 @@
import { Context } from "@oak/oak";
import { errorPageHtml } from "../html.ts";
const notFoundHandler = function (ctx: Context) {
const html = errorPageHtml(404, "Not found");
ctx.response.body = html;
ctx.response.status = 404;
};
export default notFoundHandler;