-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 825 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
35
require("dotenv").config();
const express = require("express");
const hbs = require("hbs");
const app = express();
const { PORT } = process.env;
console.log(process.env.PORT);
// HandelBars
app.set("view engine", "hbs");
hbs.registerPartials(__dirname + "/views/partials", (err) => {
if (err) {
console.log(err);
}
});
app.use(express.static("public"));
app.get("/", (req, res) => {
res.render("home", { name: "Cesar Morales", title: "Software engineer" });
});
app.get("/generic", (req, res) => {
res.render("generic", { name: "Cesar Morales", title: "Software engineer" });
});
app.get("/elements", (req, res) => {
res.render("elements", { name: "Cesar Morales", title: "Software engineer" });
});
app.get("*", (req, res) => {
res.sendFile(__dirname + "/public/404page.html");
});
app.listen(PORT);