Skip to content

Commit

Permalink
Added a 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman-G-upta committed Nov 5, 2024
1 parent 8491d78 commit ce2db5c
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ app.use(
app.use(passport.initialize());
app.use(passport.session()); // Persist user sessions

// app.use(flash());

// Global variables for flash messages
app.use((req, res, next) => {
Expand All @@ -85,9 +86,14 @@ app.set('view engine', 'ejs');
app.locals.isActiveRoute = isActiveRoute;

// Routes

app.use('/', require('./server/routes/main'));
app.use('/', require('./server/routes/admin'));

app.use((req, res, next) => {
res.status(404).render('404',{ layout: false }); // Renders the 404.ejs file
});

// Start the server
app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
Expand Down
Loading

0 comments on commit ce2db5c

Please sign in to comment.