File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
44import { DashboardController } from '../controller/dashboard.js' ;
55import { MyFileController } from '../controller/my-file.js' ;
66import { StarredController } from '../controller/starred.js' ;
7+ import { Controller } from '../controller/controller.js' ;
78
89const __filename = fileURLToPath ( import . meta. url ) ;
910const __dirname = path . dirname ( __filename ) ;
@@ -24,5 +25,15 @@ app.get('/', DashboardController.get);
2425app . get ( '/files' , MyFileController . get ) ;
2526app . get ( '/starred' , StarredController . get ) ;
2627
28+ // Catch-all 404 handler - render not-found page with default config
29+ app . use ( ( req , res ) => {
30+ const pageData = {
31+ ...Controller . defaultConfig ,
32+ page : 'not-found' ,
33+ title : '404 Not Found' ,
34+ currentPath : req . path
35+ } ;
36+ res . status ( 404 ) . render ( 'layouts/main' , pageData ) ;
37+ } ) ;
2738
2839export default app ;
Original file line number Diff line number Diff line change 1+ <main class =" flex-1 overflow-y-auto bg-background relative" >
2+ <% - include (' ../components/header' ) %>
3+
4+ <div class =" p-12 flex items-center justify-center" >
5+ <div class =" max-w-xl text-center" >
6+ <h1 class =" text-6xl font-bold text-slate-900" >404</h1 >
7+ <p class =" mt-4 text-xl text-slate-700" >Page not found</p >
8+ <p class =" mt-2 text-sm text-slate-400" >We couldn't find the page you're looking for.</p >
9+ <div class =" mt-6" >
10+ <a href =" /" class =" inline-block px-4 py-2 bg-primary text-white rounded-lg" >Go back home</a >
11+ </div >
12+ </div >
13+ </div >
14+ </main >
You can’t perform that action at this time.
0 commit comments