Netlify : The Simplicity For Deploy React JS
Bismillahirrahmaanirrahim,
Today, I’ll elucidate about how to deploy your react-js project in the netlify. I think netlify is the simple way for CI/ CD Integration because when we push our project in Github only a little second netlify will automatically build our new update from the github. Our netlify project in this article here.
- First of all, create a new react-js project using cmd
npx create-react-app netlify-app
cd netlify-app
npm start
netlify-app: name of the project
cd: change your directory to the destination path
npm start: to run react js project in deployment.
Notes: Create React App doesn’t handle backend logic or databases; it just creates a frontend build pipeline,
If you had this error when creating project and the run it, maybe in the project does not contain server.js or in the package.json project is not defined a start script.
"scripts": {
"start": "node your-script.js"
}
The Other Solution is
change your npx to npm init react-app my-app
2. Preparing Github
Create a new repository in Github, and set up the git repo in your folder project.
3. Preparing Netlify
Visit the Netlify website to config our integrations netlify and Github. I recommend that you, log in with your Github account so netlify will detect our project in Github spontaneously.
- Choose new site from git,
- There are 3 steps to integrate our project, connect to github to get our permissions, pick the repository you want to deploy, and then set up which branch you want to deploy.
To finish, click Deploy site.
When the 3 steps in the image above succeed, our project is done to deploy
Notes:
Our default domain is a random domain, with subdomain .netlify.app but you can customize it in the set up custom domain menu.
When you make a change to your project, and you push again to github production deploys will automatically deploy our project.
Change Site Name
Go to site settings -> Change site name
Stop to Deploy Automatically
Go to menu build&deploy -> stop builds -> save
Happy Coding!!! 😁😁🍜