Skip to content

Commit

Permalink
🚸 Add NOT_FOUND view
Browse files Browse the repository at this point in the history
  • Loading branch information
toridoriv committed Oct 25, 2023
1 parent 7196980 commit d569437
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions routes/_middlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ const inspectRequest = defineMiddleware(

const handleNotFound = defineMiddleware(
function handleNotFound(req, res, _next) {
res.app.logger.debug("Handling not found error...");
return res.status(404).send(`Cannot ${req.method} ${req.url}`);
return res.status(404).render("error-not-found", { path: req.url });
},
1,
);
Expand Down
2 changes: 2 additions & 0 deletions views/error-not-found.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h2>404</h2>
<h3>Oops! Page <code>{{path}}</code> not found</h3>

0 comments on commit d569437

Please sign in to comment.