-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (34 loc) · 1.12 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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const session = require("express-session");
const app = express();
const { ConnectDatabase } = require("./database/DatabaseManager.js");
const HomeRouter = require("./routes/Home.js");
const AccountRouter = require("./routes/Account.js");
const ShopRouter = require("./routes/Shop.js");
const ErrorRouter = require("./routes/Error.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("./json"));
app.use(express.static("./css"));
app.use(
session({
secret: "WebApp-NodeJs-05",
cookie: { secure: false },
saveUninitialized: false,
resave: false,
})
);
app.set("view engine", "ejs");
ConnectDatabase();
app.use("/", HomeRouter);
app.use("/account", AccountRouter);
app.use("/shop", ShopRouter);
app.use("/error", ErrorRouter);
app.listen(process.env.DEVELOPMENT_PORT, () => {
console.log(`ACTIVE | PORT: ${process.env.DEVELOPMENT_PORT}`);
});