October 9th, 2020 by cedcraftscodes
Netlify is a web development platform that can be used to host your React, Php, Python, Angular application.
In this tutorial, we are going to publish our React application in Netlify. We are not going to tackle how to create a React Application in this tutorial, but if you want to try, you can use this project created in React for testing.
The first step is to register an account here. You may use your Github / Gitlab account to signup.
After registering, execute this command to install the Netlify CLI.
npm install netlify-cli -g
You need to build your React application. Make sure you run the below commands.
npm run build
This will create a React build folder that will be needed during deployment.
If you have a React project/clone the test project above, cd to the project directory.
Execute the command below to deploy your application.
If you are asked to input the “Path to deploy”, select the build folder.
You will be redirected to an auth page so make sure you are logged in.
You will be asked to “Create & configure a new site” and the “Team Name”.
For the other fields, they are optional and you can leave them blank.
After deploying your application, Netlify will give you a link so you can visit the “Draft” site.
If all is good, deploy the app on your main site.
netlify deploy --prod
Specify the build folder again and visit your website.