0

Building a react application that consumes a rest api.

  • The rest API is in-house api built using aws API-Gateway.
  1. How can we configure the rest api url based on the environment (local/dev/qa/prod)?
  2. The rest API url might change every-time we deploy the application to AWS (Link gets generated in AWS API Gateway), Have we have to manually update the url list in the react app? Do we have a way to sync these urls among consumers?

1 Answer 1

0

How can we configure the rest api url based on the environment (local/dev/qa/prod)?

Hard to answer without more detail. This is more about configuring any variable based on the environment; your API endpoint is just example.

The rest API url might change every-time we deploy the application to AWS (Link gets generated in AWS API Gateway), Have we have to manually update the url list in the react app? Do we have a way to sync these urls among consumers?

  1. You should implement the build/deploy process such that the API is not destroyed and recreated. Cloudwatch metrics and logs are tied to the API by its ID so your monitoring would also break. Of course, having a stable endpoint is important too.
  2. I recommend looking at custom domains as well. You could even integrate your environment into the custom domain URL in a structured way i.e. prod.myendpoint.company.com or myendpoint.company.com/prod.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.