-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (55 loc) · 1.51 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
const axios = require('axios');
const express = require('express');
const morgan = require('morgan');
const app = express();
const port = 3004;
app.use(morgan('dev')); // for logging http requests to the terminal
app.use(express.json()); // for parsing application/json
app.use(express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.use(express.static('public')); // for serving static files
// Calendar Proxy Response
app.get('/month', (req, res) => {
axios.get('http://3.16.164.208:3001', {
params: req.query
})
.then(({ data }) => {
res.json(data);
})
.catch((error) => {
console.log(error);
});
});
// Image Carousel Proxy Response
app.get('/gallery/:id', (req, res) => {
var id = req.query.id;
axios.get(`http://13.57.225.193:3000/gallery/${id}`)
.then(({ data }) => {
res.json(data);
})
.catch((error) => {
console.log(error);
});
});
// Reviews Proxy Response
app.get('/api/0', (req, res) => {
axios.get(`http://13.57.226.2:3003/:3003/api/0`)
.then(({ data }) => {
res.json(data);
})
.catch((error) => {
console.log(error);
});
});
// Recommendations Proxy Response
app.get('/listings', (req, res) => {
axios.get(`http://52.53.211.102:3002/`)
.then(({ data }) => {
res.json(data);
})
.catch((error) => {
console.log(error);
});
});
app.listen(port, () => {
console.log(`server running at: http://localhost:${port}`);
})