-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
44 lines (30 loc) · 906 Bytes
/
server.js
File metadata and controls
44 lines (30 loc) · 906 Bytes
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
// * npm packages
const express = require("express");
const session = require("express-session");
const addmeme = require("./src/db/db");
// ****
const app = express();
// * routes('./src/routes')
const indexroute = require("./src/routes/index");
const memedb = require("./src/routes/cardsdb");
const memeshow = require("./src/routes/show");
// *****
// * front-end linking and post handling
app.set("view engine", "hbs");
app.set("views", "./src/public/components");
app.use("/", express.static(__dirname + "/src/public"));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// * express-session
// *******
// * dynamics
app.use("/", indexroute);
app.use("/memeadd", memedb);
app.use("/content", memeshow);
// *******
// * port
const port = process.env.PORT || 5555;
app.listen(port, () => {
console.log(`Server started at http://localhost:${port}`);
});
// *******