Render error pages as HTML
This commit is contained in:
10
handlers/not-found.ts
Normal file
10
handlers/not-found.ts
Normal 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;
|
||||
Reference in New Issue
Block a user