Summary
Azure works beautifully with both React and ASP.NET Core apps. In ASP.NET Core, we can have different appsettings.json
files to store the different settings for the different environments, such as the frontend location for CORS. In our React code, we can use an environment variable to make requests to the appropriate backend. We also need to include a web.config
file in our React app so that deep links are redirected to the index.html
page and then handled by React Router. The environment variable can be set in specific build npm
scripts for each environment. We used three environments in this chapter, but both the frontend and backend could easily be configured to support more environments.
Azure has integration from both Visual Studio and Visual Studio Code that makes deploying React and ASP.NET Core apps a breeze. We use the built-in Publish... option in Visual Studio to provision the SQL database with app services and then perform the deployment. We can also provision...