Skip to content

Commit

Permalink
error route
Browse files Browse the repository at this point in the history
  • Loading branch information
Reptudn committed Feb 19, 2025
1 parent c1d16e9 commit 254870b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions back/raw/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ app.post("/register", async (req: any, reply: any) => {
// check with db
})

// error
app.setNotFoundHandler((request, reply) => {
return reply.code(404).view('error.ejs', { error_code: '404' }, {
layout: 'basic.ejs'
});
});

/* --------------------------------- */
/* --------------STATIC------------- */
/* --------------------------------- */
Expand Down
3 changes: 3 additions & 0 deletions front/layouts/error.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1 class="err_code"><%= error_code %> PAGE NOT FOUND!</h1>
<p>Sorry, the page you are looking for does not exist.</p>
<img src="https://http.cat/<%= error_code %>" alt="<%= error_code %>" class="w-1/2 mx-auto">

0 comments on commit 254870b

Please sign in to comment.