-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
49 lines (38 loc) · 1.11 KB
/
app.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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const session = require("express-session");
const memoryStore = require("memorystore")(session);
const app = express();
const ConnectDatabase = require("./database/DatabaseManager.js");
const homeRouter = require("./routes/Home.js");
const LearnRouter = require("./routes/Learn.js");
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static("./JavaScript"));
app.use(express.static("./images"));
app.use(express.static("./fonts"));
app.use(express.static("./css"));
app.use(
session({
secret: "Codexo",
cookie: {
secure: false,
maxAge: 86400000,
},
store: new memoryStore({
checkPeriod: 86400000,
}),
saveUninitialized: false,
resave: false,
})
);
app.set("view engine", "ejs");
ConnectDatabase();
app.use("/", homeRouter);
app.use("/learn", LearnRouter);
app.listen(process.env.DEVELOPMENT_PORT || process.env.PORT, () => {
console.log(
`ACTIVE | PORT: ${process.env.DEVELOPMENT_PORT || process.env.PORT}`
);
});