How to Host Your Website on Firebase (free)




hosting your website on firebase is very easy, with just a few commands on the terminal and your website is up running. let get started.

Configuration
the first thing to do is to log on to firebase,  login and create a project, enter the name of the project and you are good to go.

Install tool
Next, we need to install the firebase tool, this can be done with the following command in your terminal. But make sure you already have nodejs and npm set up in your system.
For window users, if you are having some weird error during installation, fix the error if you can or download window sub-system for Linux and run the installation, you should be good with no errors.
npm install -g firebase-tools

Next, we need to login to the firebase on the terminal. The below command will open your browser and request you to enter your firebase credentials. after a successful login, close window and come back to the terminal.
firebase login

Next,  initialize firebase
firebase init

select the features you want to use. select hosting. you will also be asked to select your project and public directory.
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
Next, run the below command to test run your project.
firebase serve

enter localhost:5000 on your browser to make sure your website is running. If no error, run the below command to deploy your website.dj
firebase deploy

Congratulations, you have successfully hosted your website. Your website will be available as a subdomain of web.app If you need a domain, go to hosting in the firebase console and connect a domain.  each time there is an update, just run the command [firebase deploy] to update your website. 

For more information check firebase.
Thank you for reading.

Post a Comment

0 Comments