-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
42 lines (24 loc) · 848 Bytes
/
server.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
const express = require("express"),
hbs = require("express-handlebars"),
path = require("path"),
bodyParser = require("body-parser"),
favicon = require("serve-favicon"),
fileUpload = require("express-fileupload");
//// ROUTES
const index = require("./routes/index");
//////////////
const app = express();
app.engine("hbs", hbs({
extname: "hbs",
defaultLayout: "layout",
layoutsDir: path.join(__dirname, "views")}
));
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "hbs");
app.use(favicon(`${__dirname}/public/img/favicon.png`));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(fileUpload());
app.use(express.static(`${__dirname}/public`));
app.use("/", index);
app.listen(process.env.PORT || 3000, () => console.log("Server running on port 3000"));