Full-Stack Integration Analysis
Scenario
Your team has been discussing the architecture for your new MERN stack application. While the core technologies are decided, the practical details of how the React client and Express server will communicate are still being debated. Key concerns have been raised about Cross-Origin Resource Sharing (CORS), managing environment variables securely, and choosing the right data-fetching strategy.
Your tech lead has asked you to research these topics and write a brief analysis to help the team make informed decisions. Your goal is to articulate the challenges and propose solutions, demonstrating a solid understanding of full-stack application architecture.
Instructions
This lab is a reading and viewing exercise. There is no coding involved. Your task is to carefully review the following resources on full-stack application architecture and then answer the reflection questions in a written document.
Task 1: Reading & Viewing Assignment
Please review the following resources. They provide a detailed overview of common challenges and solutions when connecting a separate frontend and backend.
- Article 1: Avoiding Cross-Origin Issues While Hosting Full Projects
- Article 2: The Ultimate Guide to Setting Up Your Dev Environment for CORS and Live APIs
- Video: React Proxy | Easiest Fix to CORS Error
Focus on understanding not just the problems, but the trade-offs between different solutions.
Task 2: Written Reflection
After reviewing the materials, answer the following questions in a clear and concise manner. Your total response should be between 300 and 500 words.
-
CORS Explained: In your own words, explain what a CORS error is and why it occurs in a typical MERN stack application with separate client and server repositories. Describe two different strategies a developer could use to resolve CORS issues during local development.
-
Environment Management: Why is it considered a bad practice to hardcode API URLs directly into client-side React code? Explain how environment variables (
.env
files) help solve this on both the client (REACT_APP_...
) and server (dotenv
package). -
Data Fetching Trade-offs: The lessons covered both the native
fetch
API and theaxios
library for making API requests. Based on the resources and your own understanding, describe one key advantage of usingaxios
overfetch
for a complex application.
Submission
- Create a new document (e.g., Google Doc, Word document, or a simple Markdown file in a GitHub repository).
- Address all three reflection questions clearly.
- Submit a link to your document.
Grading
This lab is worth 50 points. Your reflection will be graded based on the following criteria:
Criteria | Description | Points |
---|---|---|
Clarity and Understanding | Your answers demonstrate a clear understanding of the concepts presented in the resources. | 20 |
Depth of Analysis | You provide thoughtful and accurate explanations, going beyond surface-level definitions. | 20 |
Completeness and Professionalism | All questions are answered, and the submission is well-written, clear, and within the word count limit. | 10 |
Total | 50 |