-
Notifications
You must be signed in to change notification settings - Fork 1
Add React proxy configuration to README for CORS handling between frontend and backend #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: eklavyamirani <1318529+eklavyamirani@users.noreply.github.com>
README.md
Outdated
|
|
||
| This proxy configuration allows your React app (running on port 3000) to make API calls to your .NET backend (running on port 5000) without CORS issues during development. | ||
|
|
||
| Alternatively, you can create a setupProxy.js file in the src folder for more advanced proxy configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put this under the advanced configuration section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've reorganized the setupProxy.js content under an "Advanced Configuration" subsection. Commit 7190ad0
| } | ||
| ``` | ||
|
|
||
| This proxy configuration allows your React app (running on port 3000) to make API calls to your .NET backend (running on port 5000) without CORS issues during development. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the proxy should come after setting up the backend application
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've moved the proxy section to appear after the .NET backend setup instructions (after the CORS configuration section). Commit 7190ad0
…onfiguration subsection Co-authored-by: eklavyamirani <1318529+eklavyamirani@users.noreply.github.com>
Updated the README to include comprehensive proxy configuration instructions for handling CORS between the React frontend and .NET backend during development.
Changes Made
Added a new section "setup proxy for react frontend to communicate with dotnet backend" that includes:
Simple proxy configuration via
package.jsonfor basic use cases:{ "proxy": "http://localhost:5000" }Advanced proxy configuration using
setupProxy.jsfor more complex scenarios:Clear explanations of the port configuration (React on 3000, .NET on 5000)
Installation instructions for required dependencies
Why This Matters
The existing README showed how to configure CORS on the .NET backend side but was missing the frontend proxy configuration. This addition provides developers with complete guidance for setting up communication between the React frontend and .NET backend without CORS issues during development.
The proxy configuration is essential because:
Fixes #1.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.