How to Deploy your website for free in 2021
Hello everybody, I hope so all of you will be healthy and safe in this era of time. Today, I told you a method through which you host any website you want.
Step 1: Need a heroku account
For deploying the website, you need a Heroku account, and if not, you have to create an account.
Through this account, you can host a maximum of 5 sites for free, and for more, you have to buy the premium.
for sign up, you can see the below image:
Step 2: Setup files for hosting.
First, install npm on your pc using the terminal. Open your terminal and write:
sudo apt install nodejs npm
npm install express body-parser
After installing, create a javascript file name ‘app.js’ and enter the below details:
write the name of your index file in the place of ‘your_html_file.html’.
Create a folder name ‘public’ in which you have to add all your CSS, images, javascript, audio, and video files.
Now, create a file name ‘Procfile’ in which you have to write web: node app.js and save the file.
Step 3: Now using git to host the website
First of init the git using your terminal in the respected folder.
Use the command: git init
Second: use the command git add .
Third: use the command git init -m “Your message”.
Fourth: use the command heroku login
Fifth: use the command heroku create “Your app name”.
Sixth: use the command git push heroku master.
And boom now your website is hosted on the live server which you will connect through any device.
And at last thanks for reading all this.