-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
102 lines (80 loc) · 2.19 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import express from "express";
import http from "node:http";
import path from "path";
import ejs from "ejs";
import createBareServer from "@tomphttp/bare-server-node";
const port = process.env.PORT || 3000;
const app = express();
const __dirname = process.cwd();
const server = http.createServer();
const bareServer = createBareServer("/bare/");
app.use(express.static("public"));
app.use(express.urlencoded({extended: false}));
app.set('view engine', 'ejs');
app.set('views', __dirname + '/views');
app.get('/', (req, res) => {
res.render("index", { title: "Home" });
});
app.get('/gxmes', (req, res) => {
res.render("gxmes", { title: "Geometry" });
});
app.get('/apps', (req, res) => {
res.render("apps", { title: "Algebra" });
});
app.get('/settings', (req, res) => {
res.render("settings", { title: "Settings" });
});
app.get('/extra', (req, res) => {
res.render('extra', { title: "Extra" });
});
app.get('/textbook', (req, res) => {
res.render('loader', { title: "Textbook" });
});
app.get('/learning', (req, res) => {
res.render('learning');
});
app.get('/mobile', (req, res) => {
res.render('mobile', { title: "Mobile" });
});
app.get('/skibiditoilet12549s', (req, res) => {
res.render('extra/testing');
});
app.get('/dashboard', (req, res) => {
res.render('dashboard', { title: "Dashboard" });
});
app.get('/teachers', (req, res) => {
res.render('teachers');
});
app.get('/tos', (req, res) => {
res.render('tos');
});
app.get('/learningMB', (req, res) => {
res.render('learningmobile')
});
app.get('/byod', (req, res) => {
res.render('aboutus')
});
app.use((req, res) => {
res.statusCode = 404;
res.render("404", { title: "404 | Error", error: "It looks like the page you were looking for doesn't exist.",});
});
server.on("request", (req, res) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeRequest(req, res);
} else {
app(req, res);
}
});
server.on("upgrade", (req, socket, head) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeUpgrade(req, socket, head);
} else {
socket.end();
}
});
server.on("listening", () => {
console.log(`Kitty Cat Club is running on: http://localhost:${port}`);
});
server.listen({
port: 3000,
});