Hello! I have a React app deployed at https://cbv3.netlify.apps, and it’s talking to an API backend that’s deployed elsewhere. I’m trying to figure out how to make sure my
request at https://cbv3.netlify.apps talks to my API hosted at https://api-staging.codebuddies.org/api/v1/auth/registration/ instead of talking to https://cbv3.netlify.apps/api/v1/auth/registration/.
Can anyone help? Thank you!
Why not use the absolute URL like you mentioned above?
If you use a relative URL in your code, the browser will always look for that path relative to your domain.
@hrishikesh Thanks for responding! The reason I don’t want to use the absolute URL is because I want to separate out development work between dev and prod.
When I pull down the repo to play with it, I want the data POSTing to my local http://localhost:8000.
However, when the app is deployed on netlify, I want the data POSTing to the production URL.