Skip to content

Project Struggles #2

@raymondYsheng

Description

@raymondYsheng

Struggles We Faced As A Team!

CORS Errors:

Having dealt with CORS errors in my project, I found that integrating the frontend, hosted on one domain, with the backend on another domain posed challenges. The struggle was particularly evident when the server didn't explicitly permit cross-origin requests. This pushed me to ensure the backend includes the necessary CORS headers like Access-Control-Allow-Origin and others. Additionally, during local development, I found using a proxy server or a CORS-disabling browser extension helpful in mitigating these issues.

Switch Cases:

Reflecting on handling multiple conditions based on variable values, I recognized that managing a series of if-else statements can quickly become unwieldy. Transitioning to using switch cases provided a more organized and readable approach. This adjustment not only enhanced the code's clarity but also made it easier to manage and maintain as the number of conditions grew.

Inheritance/Abstraction:

Navigating through the project, I encountered the need for shared functionality among different components or classes. Implementing inheritance and abstraction came to the rescue, allowing me to establish a hierarchy of classes. Creating a base class with common features and extending or implementing it in other classes facilitated code reuse and contributed to a more organized and modular structure.

API Fetching:

The struggle with fetching data from external APIs and seamlessly integrating it into the frontend was apparent. Dealing with asynchronous operations and addressing potential errors required a thoughtful approach. I leaned on features like Promises, async/await, and robust error handling to streamline API calls. Ensuring that the API server permitted requests from my frontend domain became crucial in preventing CORS-related challenges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions