-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (45 loc) · 1.16 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
const path = require("path");
const express = require("express");
const PORT = process.env.PORT || 8000;
const CLOUD_URL = process.env.CLOUD_ADDRESS ||
"https://cloud.netsblox.org";
const EDITOR_URL = process.env.EDITOR_ADDRESS ||
"https://editor.netsblox.org";
const REDIRECT_URL = process.env.REDIRECT_URL || EDITOR_URL;
let app = express();
app.use(express.static(path.join(__dirname, "public")));
app.engine("pug", require("pug").__express);
app.set("views", path.join(__dirname, "views"));
console.log("default cloud:", CLOUD_URL);
console.log("default redirect URL:", REDIRECT_URL);
const urls = {
CLOUD_URL,
REDIRECT_URL,
EDITOR_URL,
};
app.get(
"/",
(_req, res) => res.render("index.pug", urls),
);
app.get(
"/index.html",
(_req, res) => res.render("index.pug", urls),
);
app.get(
"/register.html",
(_req, res) => res.render("register.pug", urls),
);
app.get(
"/forgot-password.html",
(_req, res) => res.render("forgot-password.pug", urls),
);
app.get(
"/forgot-username.html",
(_req, res) => res.render("forgot-username.pug", urls),
);
app.listen(PORT, (err) => {
if (err) {
throw err;
}
console.log(`Listening on port ${PORT}`);
});