aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
blob: 13d321ce1a19150fe8ccd185f48e3f5bebe60b0f (plain)
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
const express = require('express');
const path = require('path');

const app = express();

const members = [
  {
	id: 1,
	name: 'Garth Brooks',
	email: 'garth.brooks@gmail.com',
	status: 'active'
  },
  {
    id: 2,
	name: 'Bob Evans',
	email: 'bob.evans@gmail.com',
	status: 'inactive'
  },
  {
	id: 3,
	name: 'Alan Jackson',
	email: 'alan.jackson@gmail.com',
	status: 'active'
  }
];

// Gets all members
app.get('/api/members', (req, res) => res.json(members));


// Set static directory
app.use(express.static(path.join(__dirname, 'public')));

const PORT = process.env.PORT || 3000;

app.listen(PORT, () => console.log(`Server started on port ${PORT}`));