-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (28 loc) · 1.08 KB
/
main.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
const port = 3000,
http = require("http"),
httpStatus = require("http-status-codes"),
router = require("./router"),
contentTypes = require("./contentTypes"),
utils = require("./utils");
router.get("/", (req, res) => {
res.writeHead(httpStatus.OK, contentTypes.html);
utils.getFile("views/index.html", res);
});
router.get("/index.html", (req, res) => {
res.writeHead(httpStatus.OK, contentTypes.html);
utils.getFile("views/index.html", res);
});
router.get("/index", (req, res) => {
res.writeHead(httpStatus.OK, contentTypes.html);
utils.getFile("views/index.html", res);
});
router.get("/info", (req, res) => {
res.writeHead(httpStatus.OK, contentTypes.html);
utils.getFile("views/info.html", res);
});
router.get("/info.html", (req, res) => {
res.writeHead(httpStatus.OK, contentTypes.html);
utils.getFile("views/info.html", res);
});
http.createServer(router.handle).listen(port);
console.log(`The server is listening on port number: ${port}`);