-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
47 lines (37 loc) · 1.1 KB
/
app.js
File metadata and controls
47 lines (37 loc) · 1.1 KB
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
const express = require("express");
const handlebars = require("handlebars");
const {
allowInsecurePrototypeAccess,
} = require("@handlebars/allow-prototype-access");
const app = express();
const path = require("path");
const db = require("./config/database");
const exphbs = require("express-handlebars");
const bodyParser = require("body-parser");
const exp = require("constants");
app.use(express.json());
const APP_PORT = process.env.PORT || 5000;
app.listen(APP_PORT, (req, res) => {});
db.authenticate()
.then(() => {
console.log(`Connection established `);
})
.catch((err) => {
console.log(err);
});
app.set("view engine", "handlebars");
app.get("/", (req, res) => res.render("index", { layout: "landing" }));
app.use(express.static(path.join(__dirname, "public")));
app.use(express.urlencoded({ extended: false }));
app.use("/dir", require("./routes/dir"));
app.use("/dir/", require("./routes/add"));
app.engine(
"handlebars",
exphbs({
defaultLayout: "main",
runtimeOptions: {
allowProtoPropertiesByDefault: true,
allowProtoMethodsByDefault: true,
},
})
);