-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
42 lines (34 loc) · 1.05 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
/* eslint-disable no-undef */
// Import essential libraries
const express = require("express");
const app = express();
const path = require("path");
// const router = express.app();
// eslint-disable-next-line no-undef
app.use(express.static(__dirname + "/"));
// Setup essential routes
app.get("/", function (req, res) {
// eslint-disable-next-line no-undef
res.sendFile(path.join(__dirname + "/index.html"));
});
app.get("/about", function (req, res) {
// eslint-disable-next-line no-undef
res.sendFile(path.join(__dirname + "/105/about-me/index.html"));
});
app.get("/search-result", function (req, res) {
// eslint-disable-next-line no-undef
res.sendFile(path.join(__dirname + "/search/result/index.html"));
});
app.get('/test105', function (req, res) {
res.status(200).json({
message: "Hello World!"
});
});
app.get("/*", function (req, res) {
// eslint-disable-next-line no-undef
res.sendFile(path.join(__dirname + "404.html"));
});
const PORT = 1050;
app.listen(PORT, () => {
console.log(`Running on http://localhost:${PORT}`);
});