-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (42 loc) · 1.29 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
const express = require("express"),
config = require("config"),
db = require("./db"),
path = require("path"),
admin = require("./admin"),
user = require("./user"),
auth = require("./auth"),
helmet = require("helmet"),
compression = require("compression"),
app = express(),
init = express.Router();
init.get("/favicon", (req, res) => {
res.sendFile(path.join(__dirname + "/public/IMG/favicon.ico"));
}),
init.get("/", (req, res) => {
res.redirect("/u/home");
}),
app.use(express.static("public")),
app.use(express.urlencoded({ extended: !0 })),
app.use(express.json()),
app.use(
helmet.contentSecurityPolicy({
directives: {
"default-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
"script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
"img-src": ["'self'", "data:", "https:"],
},
})
),
app.use(compression()),
app.use("/su", admin),
app.use("/u", user),
app.use("/a", auth),
app.use("/", init),
app.use("/p", express.static("public"));
const port = process.env.PORT || 2905;
db.connect((err) => {
if (err) throw err;
app.listen(port, () => {
console.log("[+] Server Started on PORT:", port);
});
});