-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
39 lines (31 loc) · 1.03 KB
/
server.js
File metadata and controls
39 lines (31 loc) · 1.03 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
const express = require("express");
const app = express();
const port = process.env.PORT || 3000;
const path = require("path");
const cors = require("cors");
const httpProxy = require("http-proxy");
const proxy = httpProxy.createProxyServer({});
app.use(cors());
app.use(express.static(path.join(__dirname, "public")));
app.all("/api/*", (req, res) => {
proxy.web(req, res, {
target: "http://ec2-18-222-0-232.us-east-2.compute.amazonaws.com/"
});
});
app.all("/locations/*", (req, res) => {});
app.all("/prices/*", (req, res) => {
proxy.web(req, res, {
target: "http://ec2-18-222-174-176.us-east-2.compute.amazonaws.com/"
});
});
app.all("/hotels/*", (req, res) => {
proxy.web(req, res, {
target: "http://ec2-18-188-161-215.us-east-2.compute.amazonaws.com/"
});
});
app.all("/header/*", (req, res) => {
proxy.web(req, res, {
target: "http://ec2-3-17-179-159.us-east-2.compute.amazonaws.com/"
});
});
app.listen(port, () => console.log(`Proxy server running on port ${port}`));