-
Notifications
You must be signed in to change notification settings - Fork 15
/
app.js
34 lines (26 loc) · 753 Bytes
/
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
const express = require("express");
const session = require("express-session");
const flash = require("connect-flash");
const expressLayout = require("express-ejs-layouts");
const app = express();
const PORT = 5000 || process.env.PORT;
app.use(express.static("public"));
// Set up session and flash middleware
app.use(
session({
secret: "alifarhadrules",
resave: false,
saveUninitialized: true,
})
);
app.use(flash());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
//templating engine
app.use(expressLayout);
app.set("layout", "./layouts/main");
app.set("view engine", "ejs");
app.use("/", require("./server/routes/main"));
app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
});