-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
48 lines (36 loc) · 1.07 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
const express = require("express");
const ejs = require("ejs");
require("dotenv").config();
const app = express();
app.set("view engine", "ejs");
app.use(express.static("public"));
app.use(express.urlencoded({ extended: true }));
const contactRoutes = require("./routes/contactRoutes");
const newsletterRoutes = require("./routes/newsletterRoutes");
app.get("/", (req, res) => {
res.render("home");
});
app.get("/menu", (req, res) => {
res.render("menu");
});
app.get("/about", (req, res) => {
res.render("about");
});
app.use("/contact", contactRoutes);
app.get("/faqs", (req, res) => {
res.render("faqs");
});
app.use(newsletterRoutes);
app.get("/loading", (req, res) => {
res.render("partials/preloader", { title: "loading" });
});
app.listen(3000 || process.env.PORT, (req, res) => {
const currentDate = new Date();
const currentTime = currentDate.toLocaleTimeString([], {
hour: "numeric",
minute: "2-digit",
});
console.log(
`${currentTime} | Cafesy is up & Running on http://127.0.0.1:3000/.`
);
});