Skip to content

Commit fcf0aa5

Browse files
committed
export http api url for frontend and setup proxy
1 parent c2fded4 commit fcf0aa5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

serverless.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ custom:
5151
- UserPoolWebClientId
5252
- IdentityPoolId
5353
- LoginSubDomain
54-
- CloudFrontDistribution
54+
- CloudFrontDistribution-
55+
- HttpApiUrl
5556
output:
5657
file: ./.env
5758
format: toml

src/setupProxy.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { createProxyMiddleware } = require('http-proxy-middleware');
2+
module.exports = function (app) {
3+
app.use('/api/*',
4+
createProxyMiddleware({
5+
target: `${process.env.REACT_APP_CONNECT || process.env.REACT_APP_HTTP_API_URL}`,
6+
changeOrigin: true,
7+
logLevel: 'debug',
8+
secure: false
9+
})
10+
);
11+
};

0 commit comments

Comments
 (0)