Azure
Host A React App On Azure From VS Code
Microsoft Azure, which is known as Azure, offers cloud computing service created by Microsoft for testing, constructing, managing purposes, deploying, and companies by way of managed information facilities.
Azure Internet app companies are cloud computing-based platform the place you may publish or host your web sites. It permits a number of frameworks and net purposes to be host which is developed in numerous programming languages.
For extra element about Azure pricing or on-line worth calculator for Azure – Right here
On this article, we are going to learn to host React purposes on Azure.
Let’s get began,
Step 1 – React Undertaking Setup
Create React software utilizing the create-react-app command
Set up create-react-app globally
- $ npm set up -g create-react-app@3.4.1
Create a New Undertaking
- $ create-react-app my-app
- $ cd my-app
Your newly created React software’s folder construction ought to appear to be this

Run ‘npm begin’ command in terminal to launch created app regionally. You’ll be able to entry react app on 3000 port of your localhost so open/click on on http://localhost:3000 to launch it within the browser to see.

Step 2
Create new file net.config on root
- <?xml model=“1.0”?>
- <configuration>
- <system.webServer>
- <rewrite>
- <guidelines>
- <rule identify=“React Routes” stopProcessing=“true”>
- <match url=“.*” />
- <circumstances logicalGrouping=“MatchAll”>
- <add enter=“{REQUEST_FILENAME}” matchType=“IsFile” negate=“true” />
- <add enter=“{REQUEST_FILENAME}” matchType=“IsDirectory” negate=“true” />
- <add enter=“{REQUEST_URI}” sample=“^/(api)” negate=“true” />
- </circumstances>
- <motion kind=“Rewrite” url=“/” />
- </rule>
- </guidelines>
- </rewrite>
- </system.webServer>
- </configuration>
Step 3 – Create a construct of your react software
Run ‘npm run construct’ or ‘yarn construct’ in your terminal which is able to generate a manufacturing optimized construct of React software into the construct folder.
Step 4
Now set up ‘Azure App Service’ extension in VSCode.


Step 5
After set up, choose Azure App service tab and click on on ‘+’ icon for creating a brand new net software


Step 6

Step 7
Then, you must select few choices like subscription, distinctive identify of your web site Url, and setting of the server (ex. Home windows or Linux)

Step 8
Will probably be prompted for deploy or cancel choices, you must select Deploy possibility
Step 9
Now you must select a path of your construct folder in software to deploy your software

Step 10
As soon as the Deployment is course of is accomplished, you may browse your react app service URL (in my case it’s https://sample-react-azure-app.azurewebsites.internet), You’ll be able to see now your react software is hosted on Azure server efficiently.
