Skip to content

Refactor hardcoded API base URL to use environment configuration #272

Description

@avinxshKD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions