-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
index.js
29 lines (20 loc) · 689 Bytes
/
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
const express = require('express');
const app = express();
const path = require('path');
//Serves resources from public folder
app.use(express.static(path.join(__dirname, 'public')));
app.set('view engine', 'ejs');
const fs = require('fs');
app.get('/', (req, res) => {
let rawdata = fs.readFileSync('./Data/member.json');
let contributors = JSON.parse(rawdata);
console.log(contributors);
res.render('index', { members: contributors })
})
//connection to server
app.listen(process.env.PORT, error => {
if (error) console.log("error is " + error);
else console.log("listening to port " + 3000);
});
// For running this project locally.
// app.listen(3000);