Skip to content

Commit

Permalink
Merge pull request #159 from Samani-Humaira/ErrorPage
Browse files Browse the repository at this point in the history
Added 404 error page
  • Loading branch information
Sahil1786 authored Jun 8, 2024
2 parents 50607f3 + da4cec0 commit 263584d
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ app.listen( process.env.port|| 3000,function(){
// Route for policies.ejs
app.get('/policies', (req, res) => {
res.render('policies'); // Ensure policies.ejs is in the views directory
});

app.get("/*",(req,res) =>{
res.render("Error");
});
Binary file added public/img/Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions views/Error.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="css/admin_css.css">
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
<title> Error </title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.error-container h1 {
font-size: 7rem;
color: blue;
margin-bottom: 20px;
}
.error-container p {
font-size: 1.25rem;
color: #6c757d;
margin-bottom: 10px;
}
.error-container a {
display: inline-block;
margin-top: 20px;
padding: 10px 10px;
font-size: 1rem;
color: #ffffff;
background-color: blue;
border: none;
border-radius: 5px;
text-decoration: none;
}
.error-container a:hover {
background-color: #0056b3;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 0;
margin:0;
}
.container img {
width: 230px;
height:300px;
margin: 10px;
}
.container div {
text-align: center;
margin: 10px;
}
@media (max-width: 768px) {
.container {
flex-direction: column;
}
}
</style>
</head>
<body>
<!-- Dark Mode -->
<button id="darkModeToggle" class="btn btn-dark">
<i id="darkModeIcon" class="fas fa-sun"></i>
</button>

<div class="container">
<div>

<img src="img/Error.png" style="width: 250px;">

</div>

<div >
<div class="error-container">
<h1>404</h1>
<p>OOPS! IT LOOKS LIKE YOU'RE LOST</p>
<p>GO BACK TO <a href="/">Homepage</a></p>

</div>

</div>


<script>
document.addEventListener('DOMContentLoaded', function () {
const darkModeToggle = document.getElementById('darkModeToggle');
const darkModeIcon = document.getElementById('darkModeIcon');
const body = document.body;
const isDarkMode = localStorage.getItem('darkMode') === 'true';
// Function to toggle dark mode
function toggleDarkMode() {
const isDark = body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
darkModeIcon.className = isDark ? 'fas fa-moon' : 'fas fa-sun'; // Change icon based on mode
}
// Set initial mode based on localStorage
if (isDarkMode) {
toggleDarkMode();
}
// Event listener for dark mode toggle button
darkModeToggle.addEventListener('click', toggleDarkMode);
});
</script>

</body>
</html>

0 comments on commit 263584d

Please sign in to comment.