Skip to content
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

Faced issues with API calls during Development #13

Open
BattleOfPlassey opened this issue Oct 18, 2020 · 4 comments
Open

Faced issues with API calls during Development #13

BattleOfPlassey opened this issue Oct 18, 2020 · 4 comments

Comments

@BattleOfPlassey
Copy link

BattleOfPlassey commented Oct 18, 2020

To tell the React development server to proxy any unknown requests to your node API server in development, you can add a proxy field to your client package.json, for example:

"proxy": "http://localhost:5000"

which will redirect all traffic to node API and not REACT Development URL.

This way, when you fetch('/api/articles') in development, the development server will recognize that it’s not a static asset, and will proxy your request to http://localhost:5000/api/articles as a fallback.

@ogeobubu
Copy link

ogeobubu commented Dec 10, 2020

You might face a challenge using http:// instead of https://. Not adding the s to it might cause a problem when calling API.

@hemakshis
Copy link
Owner

I did try the proxy option then but was not working for me. But works in my new projects. I am happy to assign this issue to you if you are interested to solve 😀

@BattleOfPlassey
Copy link
Author

Yes thank-you, i will be happy to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@hemakshis @BattleOfPlassey @ogeobubu and others