-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
42 lines (31 loc) · 1.24 KB
/
server.js
File metadata and controls
42 lines (31 loc) · 1.24 KB
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
"use strict";
(() => {
const express = require("express");
const path = require("path");
const app = express();
app.use(express.static("public")); // necessary to be able to access js and css files on client side
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname + "/public/index.html"));
});
app.get("/web-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/web-worker/index.html"));
});
app.get("/without-web-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/web-worker/without/index.html"));
});
app.get("/with-web-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/web-worker/with/index.html"));
});
app.get("/service-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/service-worker/index.html"));
});
app.get("/without-service-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/service-worker/without/index.html"));
});
app.get("/with-service-worker", (req, res) => {
res.sendFile(path.join(__dirname + "/public/service-worker/with/index.html"));
});
const listener = app.listen(8080, () => {
console.log(`Server started, please go on port ${listener.address().port}`);
});
})();