-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (33 loc) · 1.11 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
const express = require("express");
const app = express();
const port = 3000;
const handlebars = require("express-handlebars");
app.engine("handlebars", handlebars({
defaultLayout: "main"
}));
app.set("view engine", "handlebars");
// Setup body-parser
const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({extended: false}));
// Setup cookie-parser
const cookieParser = require("cookie-parser");
app.use(cookieParser("userinfoo"));
// Setup express-session
const session = require("express-session");
app.use(session({
resave: true,
saveUninitialized: true,
secret: "userinfoo"
}));
// make public available statically
const path = require("path");
app.use(express.static(path.join(__dirname, "public")));
app.use(require("./routes/user-manager-routers.js"));
app.use(require("./routes/home-routers.js"));
app.use(require("./routes/post-manager-routers.js"));
app.use(require("./routes/fulltext-routers.js"));
app.use(require("./routes/comment-reply-routers.js"));
app.use(require("./routes/search-routers.js"));
app.listen(port, () => {
console.log(`App listening on port ${port}`)
});