-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
56 lines (49 loc) · 2.15 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
50
51
52
53
54
55
56
//==============================================================================
// ■ App (app.js)
//------------------------------------------------------------------------------
// Application entry point.
//==============================================================================
require("./utils");
const app = require("express")();
//------------------------------------------------------------------------------
// ► Exports
//------------------------------------------------------------------------------
module.exports = app;
//------------------------------------------------------------------------------
// ● Reloader
//------------------------------------------------------------------------------
if (app.get("env") === "development") {
const reloader = require("./reloader");
app.use(reloader);
}
//------------------------------------------------------------------------------
// ● Console-Logger
//------------------------------------------------------------------------------
const morgan = require("morgan");
app.use(morgan("dev"));
//------------------------------------------------------------------------------
// ● Body-Parser
//------------------------------------------------------------------------------
const { json, urlencoded } = require("body-parser");
app.use(json());
app.use(urlencoded({ extended: true }));
//------------------------------------------------------------------------------
// ● Cookie-Session
//------------------------------------------------------------------------------
const cookieSession = require("cookie-session");
app.use(
cookieSession({
name: "0db-example",
keys: ["a4d1-f4hh-110x-1c44-5sd1x", "c47f-x4s1-7xx8-s5e1-a5s1"],
})
);
//------------------------------------------------------------------------------
// ● Router
//------------------------------------------------------------------------------
const router = require("./router");
app.use(router);
//------------------------------------------------------------------------------
// ● Template-Engine
//------------------------------------------------------------------------------
app.set("view engine", "ejs");
app.set("views", "./");