-
Notifications
You must be signed in to change notification settings - Fork 23
Description
have noticed that the backend API endpoint is hardcoded to http://127.0.0.1:5000 in several places throughout the application, specifically in src/graph-builder/graph-core/6-server.js and src/component/modals/ContributeDetails.jsx
This tight coupling makes it difficult to deploy the frontend against any remote backend or even a local backend running on a different port.
Proposed Solution: We should extract this base URL into a centralized configuration module. Since the project is using create-react-app, we can leverage process.env.REACT_APP_API_BASE_URL to allow configuration via environment variables at build time.
We should extract this base URL into a centralized configuration module. Since the project is using create-react-app, we can leverage process.env.REACT_APP_API_BASE_URL to allow configuration via environment variables at build time.
-
Create a src/config.js or similar to export the API base URL.
-
Use process.env.REACT_APP_API_BASE_URL with a fallback to http://127.0.0.1:5000.
-
Replace all hardcoded string occurrences with this imported constant.