-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (26 loc) · 889 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require("express");
const path = require("path");
const app = express();
// Serve static files from the 'public' folder
app.use(express.static(path.join(__dirname, "public")));
// Route to serve the main HTML file
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
});
// Route to serve the quiz page
app.get("/quiz", (req, res) => {
res.sendFile(path.join(__dirname, "public", "quiz.html"));
});
// Route to serve the goals page
app.get("/goals", (req, res) => {
res.sendFile(path.join(__dirname, "public", "goals.html"));
});
// Route to serve the resources page
app.get("/resources", (req, res) => {
res.sendFile(path.join(__dirname, "public", "resources.html"));
});
// Start the server on port 3000
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});