-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
69 lines (58 loc) · 2.13 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const express = require("express"),
app = express(),
config = require("./config.json"),
fs = require("fs"),
path = require("path"),
https = require('https'),
session = require('express-session'),
{ Database } = require("quickmongo"),
db = {
account: new Database("mongodb://localhost/account"),
recommend: new Database("mongodb://localhost/recommend"),
community: new Database("mongodb://localhost/community"),
serial: new Database("mongodb://localhost/serial"),
},
// options = {
// ca: fs.readFileSync('./pem/fullchain.pem'),
// key: fs.readFileSync('./pem/privkey.pem'),
// cert: fs.readFileSync('./pem/cert.pem')
// },
modules = {
sha256: require('./scripts/sha256'),
aes: require("./scripts/aes"),
randomcode: require('uuid4'),
ip: require('request-ip'),
nodemailer: require('nodemailer'),
info: {
smtpServerURL: "smtp.gmail.com",
authUser: "OOindeul@gmail .com",
authPass: "cpuproject"
},
moment: require('moment-timezone'),
Discord: require("discord.js")
}
app.use(session({
secret: '!@V()I!#KP#VKMLWEBWERJNO',
resave: false,
saveUninitialized: true
}));
app.use(express.json())
app.use(express.urlencoded({ extended: false }));
app.use(express.static('public'));
app.use(express.static(path.join(__dirname, "client")));
app.set('views', path.join(__dirname, './views'))
app.set("view engine", "ejs");
app.engine("html", require("ejs").renderFile);
app.listen(config.port, () => {
console.log("Web is Ready");
});
// https.createServer(options, app).listen(443);
require("./router/main")(app, config, db);
require("./router/report")(app, config, db);
require("./router/recommend")(app, config, db, modules);
require("./router/account")(app, config, db, modules);
require("./router/register")(app, config, db, modules);
require("./router/discord.js")(config, db, modules);
app.use(function (req, res, next) {
res.status(404).render("./mobile/www/Error.html");
});