File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1- const { REACT_APP_HOST_ADDRESS , REACT_APP_SERVER_PORT } = process . env ;
1+ const {
2+ REACT_APP_NODE_ENV , //
3+ REACT_APP_SERVER_HOST_ADDRESS , //
4+ REACT_APP_SERVER_PORT , //
5+ } = process . env ;
26
37export class HTTP {
48 private domain : string = "" ;
@@ -43,7 +47,11 @@ export class HTTP {
4347}
4448
4549const instance = new HTTP (
46- `http://${ REACT_APP_HOST_ADDRESS } :${ REACT_APP_SERVER_PORT } `
50+ `http://${
51+ REACT_APP_NODE_ENV === "production"
52+ ? REACT_APP_SERVER_HOST_ADDRESS
53+ : "localhost"
54+ } :${ REACT_APP_SERVER_PORT } `
4755) ;
4856
4957export default instance ;
Original file line number Diff line number Diff line change 1+ # If you want to deploy the production, put the "production".
2+ REACT_APP_NODE_ENV = " development"
3+
14# Client port number to open this react-app.
2- PORT = 80
5+ PORT = 3000
36
47# Enter the same value as the PORT environment variable written in .server.env.
58REACT_APP_SERVER_PORT = 8000
69
710# Put the IP or host address of the computer you are using.
8- REACT_APP_HOST_ADDRESS = " 52.78.64.144"
11+ # The REACT_APP_SERVER_HOST_ADDRESS below only works when REACT_APP_NODE_ENV is "production", otherwise it works as "localhost".
12+ REACT_APP_SERVER_HOST_ADDRESS = " localhost"
You can’t perform that action at this time.
0 commit comments