-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (37 loc) · 1.27 KB
/
index.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
49
50
51
52
53
54
55
56
57
58
59
const express = require("express");
const path = require("path");
const logger = require("./logger");
const ejs = require('ejs')
const members = require("./data/members")
const moment = require('moment')
const app = express();
// Ejs Setup
// app.set("view engine", "ejs");
// Body Parser middleware
// app.use(express.urlencoded({ extended: true }))
// Set static folder
// app.use(express.static(path.join(__dirname, "public")));
// Initializing middleware
// app.use(logger)
// app.get('/',(req,res) => {
// res.send("<h1>Hello World!</h1>")
// })
// // Get all members
// app.get("/api/members", (req, res) => {
// res.json(members);
// });
// // Get specific members
// app.get("/api/members/:id", (req, res) => {
// const found = members.some((member) => member.id === parseInt(req.params.id));
// if (found) {
// res.json(members.filter((member) => member.id === parseInt(req.params.id)));
// } else {
// res.status(400).json({ message: `No user for id ${req.params.id}` });
// }
// });
// app.use("/api/members",require('./routes/members'))
// app.get('/', function(req, res) {
// res.render('test.ejs',{members :members});
// });
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server Started on PORT ${PORT}`));