-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
50 lines (48 loc) · 1.88 KB
/
Copy pathrouter.js
File metadata and controls
50 lines (48 loc) · 1.88 KB
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
const express = require('express');
const request = require('request');
const router = express.Router();
router.get('/information/:id', (req, res) => {
const path = req.params.id;
const url = `http://foodigosidebar-env.us-east-2.elasticbeanstalk.com/information/${path}`;
request(url).pipe(res);
});
router.get('/pictures/:id', (req, res) => {
const path = req.params.id;
const url = `http://foodigopictures.us-west-1.elasticbeanstalk.com/pictures/${path}`;
request(url).pipe(res);
});
router.get('/title/:id', (req, res) => {
const path = req.params.id;
const url = `http://foodigotitle-env.us-west-1.elasticbeanstalk.com/title/${path}`;
request(url).pipe(res);
});
router.get('/map/:id', (req, res) => {
const path = req.params.id;
const url = `http://foodigotitle-env.us-west-1.elasticbeanstalk.com/map/${path}`;
request(url).pipe(res);
});
router.get('/restaurants/:restaurantId/reviews', (req, res) => {
const path = req.params.restaurantId;
const url = `http://foodigoreviews.us-west-1.elasticbeanstalk.com/restaurants/${path}/reviews`;
request(url).pipe(res);
});
router.put('/restaurants/:restaurantId/reviews/:reviewId', (req, res) => {
const path = req.params.restaurantId;
const review = req.params.reviewId;
const url = `http://foodigoreviews.us-west-1.elasticbeanstalk.com/restaurants/${path}/reviews/${review}`;
request.post(url, { json: req.body })
.pipe(res);
});
router.post('/restaurants/:restaurantId/reviews', (req, res) => {
const path = req.params.restaurantId;
const url = `http://foodigoreviews.us-west-1.elasticbeanstalk.com/restaurants/${path}/reviews`;
request.post(url, { json: req.body })
.pipe(res);
});
router.post('/', (req, res) => {
const path = req.params.restaurantId;
const url = `http://foodigotitle-env.us-west-1.elasticbeanstalk.com/${path}`;
request.post(url, { json: req.body })
.pipe(res);
});
module.exports = router;