-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
58 lines (47 loc) · 1.12 KB
/
server.js
File metadata and controls
58 lines (47 loc) · 1.12 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
51
52
53
54
55
56
57
58
const express = require('express');
const path = require('path');
const app = express();
const proxy = require('http-proxy-middleware');
const compression = require('compression');
app.use(compression());
// app.get('/', (req, res) => {
// res.redirect('movies/1');
// })
app.use(express.static(path.join(__dirname, 'public')));
// app.get("/movies/:id", function(req, res) {
// const reactPath = path.join(__dirname, "public/index.html");
// res.sendFile(reactPath);
// });
app.use('/api/movies/:movieId/summary',
proxy({
target: 'http://localhost:3007'
})
)
app.use('/api/movies/:movieid/rating',
proxy({
target: 'http://localhost:3013'
})
)
app.get('/api/movies/:movieid/reviews',
proxy({
target: 'http://localhost:3013'
})
)
app.get('/api/movies/:genre/relatedmovies',
proxy({
target: 'http://localhost:3003'
})
)
app.get('/api/movies/:movie/:date/:location',
proxy({
target: 'http://localhost:3002'
})
)
app.get('/api/moviesbyid/:movieid/:date/:location',
proxy({
target: 'http://localhost:3002'
})
)
app.listen(3000, () => {
console.log('listening at port 3000');
})