-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
93 lines (70 loc) · 2.18 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const express = require('express');
const path = require('path');
const Axios = require('axios');
const app = express();
const PORT = 3000;
app.use(express.json());
app.use(express.static(path.join(__dirname, './client/public')));
app.get('/app/:id', (req, res) => {
res.sendFile(path.join(__dirname, '/client/public/index.html'));
});
app.get('/api/gamereviews/:gameId', (req, res) => {
Axios.get('http://ec2-13-59-202-34.us-east-2.compute.amazonaws.com:3001/api/gamereviews/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.get('/api/description/:gameId', (req, res) => {
Axios.get('http://ec2-13-59-202-34.us-east-2.compute.amazonaws.com:3005/api/description/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.get('/api/reviewcount/:gameId', (req, res) => {
Axios.get('http://ec2-34-211-181-237.us-west-2.compute.amazonaws.com:3002/api/reviewcount/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.get('/api/tags/:gameId', (req, res) => {
Axios.get('http://ec2-34-211-181-237.us-west-2.compute.amazonaws.com:3006/api/tags/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.get('/api/dlc/:gameId', (req, res) => {
Axios.get('http://ec2-13-56-224-137.us-west-1.compute.amazonaws.com:3003/api/dlc/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.get('/api/name/:gameId', (req, res) => {
let param = req.params.gameId;
});
app.get('/api/media/:gameId', (req, res) => {
Axios.get('http://ec2-18-188-192-44.us-east-2.compute.amazonaws.com:3004/api/media/' + req.params.gameId)
.then(({ data }) => {
res.status(200).send(data);
})
.catch((err) => {
console.error(err);
});
});
app.listen(PORT, () => {
console.log(`listening on port ${PORT}`);
});