Skip to content

Commit adb9bf2

Browse files
committed
Update API_URL management (loaded from ENV)
1 parent 6b5265c commit adb9bf2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REACT_APP_BACKEND_SERVER='https://YOUR_API_URL/';

src/config/constant.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
export const API_SERVER = "http://localhost:5000/api/";
1+
let BACKEND_SERVER = null;
2+
if (process.env.REACT_APP_BACKEND_SERVER) {
3+
BACKEND_SERVER = process.env.REACT_APP_BACKEND_SERVER;
4+
} else {
5+
BACKEND_SERVER = "http://localhost:5000/api/";
6+
}
7+
8+
export const API_SERVER = BACKEND_SERVER;

0 commit comments

Comments
 (0)