I am building a React app and using Azure Web Apps for hosting. During development time I set my endpoints to localhost throughout my code, but this will not work when deployed as there is no concept of localhost when on Azure. How can I go about managing my endpoints between local and deployed environments? Do I have to do conditional checks during Startup and set a variable that I then reference, or is there an easier way to manage this?
1 Answers
2
votes
Aside from using relative paths (vs absolute paths prefixed with localhost), Azure Web Apps offers application settings which are settable outside of your app, and then read in through the environment (via your app).
Take a look under your Web App's application settings, where you can create various settings for your app. For example:
For local dev, you can have your own local environment settings e.g. app_uri = localhost, and for the deployed app, set to something like https://some-address.com, configured via Application Settings.

//localhosturl's in your code? Not relative paths? - David Makogon