-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.proxyrc.js
45 lines (37 loc) · 1.35 KB
/
.proxyrc.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
/**
* Development server built as an express application.
*
* We run the frontend application (thanks to parcel-bundler)
* and the API proxy server (thanks to http-proxy-middleware)
* on localhost:1234 so we don't have to deal with CORS.
*
* Note: to run the development server must be set IO_PAY_PORTAL_API_HOST=http://localhost:1234
* and apiHost with the host api (for example http://localhost:80).
*/
const {createProxyMiddleware} = require("http-proxy-middleware");
const express = require('express')
const path = require('path')
const apiHost = "http://127.0.0.1:8080";
const apiBasepath = "/checkout/payments/v1";
const pmBasepath = "/pp-restapi/v4";
const transactionsBasepath = "/checkout/payment-transactions/v1";
const ecommerceBasepath = "/ecommerce/checkout/v1";
const ecommerceBasepathV2 = "/ecommerce/checkout/v2";
module.exports = function (app) {
app.use(createProxyMiddleware(apiBasepath, {
target: apiHost,
}));
app.use(createProxyMiddleware(transactionsBasepath, {
target: apiHost,
}));
app.use(createProxyMiddleware(pmBasepath, {
target: apiHost,
}));
app.use(createProxyMiddleware(ecommerceBasepath, {
target: apiHost,
}));
app.use(createProxyMiddleware(ecommerceBasepathV2, {
target: apiHost,
}));
app.use('/', express.static(path.join(__dirname, 'static')))
}