diff --git a/frontend/404.html b/frontend/404.html
new file mode 100644
index 00000000..ea707228
--- /dev/null
+++ b/frontend/404.html
@@ -0,0 +1,294 @@
+
+
+
+
+
+ 404 — Not Found | CodePVG
+
+
+
+
+
+
+
+
+
+
+
+
+
404 — Not Found
+
+ > route resolution failed. filesystem integrity nominal.
+
+
+
+
+
+
+ guest@codepvg:~$
+ cd /unknown-path
+
+
+ bash: cd: /unknown-path: No such file
+ or directory
+
+
+
+
+
+
+
+
+
+
+
+
+ guest@codepvg:~$
+ ls /valid-routes
+
+
+
+
+
+ guest@codepvg:~$
+
+
+
+
+
+
+
+
+
diff --git a/server.js b/server.js
index 298ff019..2dee9a9b 100644
--- a/server.js
+++ b/server.js
@@ -1,6 +1,6 @@
const express = require("express");
-const cors = require("cors");
const path = require("path");
+const cors = require("cors");
const app = express();
const PORT = process.env.PORT || 3000;
@@ -57,8 +57,9 @@ app.get("/api/student/:username", async (req, res) => {
}
});
+// 404 handler
app.use((req, res) => {
- res.status(404).send("Page not found");
+ res.status(404).sendFile(path.join(__dirname, "frontend", "404.html"));
});
app.listen(PORT, () => {