-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (24 loc) · 793 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
// DECLARATION OF ALL REQUIRE VARIABLES
let express = require("express"),
path = require("path"),
app = express(),
bodyParser = require("body-parser"),
server = require("http").createServer(app),
io = require("./io").initialize(server),
port = process.env.PORT || 3000,
generalRoutes = require("./routes/general");
// SETTING UP THE SERVER
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true }));
app.get("/about", (req, res) => {
res.render("about");
});
app.use("/chat", generalRoutes);
app.get("/", (req, res) => {
res.render("index");
});
app.use(express.static(path.join(__dirname, "public")));
io.on("connection", () => {});
server.listen(port, () => {
console.log("[SERVER ONLINE] Server started at http://localhost:%d", port);
});