– 22nd March, 2020
Setup Firebase hosting in 30 seconds
Have you ever had the need to get some web hosting really quickly to show off a demo? Or to showcase a new clients website? Or just want to a new place to host your personal blog from?
Well, Firebase hosting from Google could really come in handy here and it most likely won’t cost you a penny.
So what is Firebase hosting?
Firebase Hosting is a fully-managed hosting service for static and dynamic content as well as microservices and to top it off, all sites that are hosted on Firebase recieve a free SSL certificate so your content is always delivered securley.
By default, every Firebase project has free subdomains on the web.app and firebaseapp.com domains but you can add easily add a custom domain to use instead.
How to get started with Firebase hosting?
To get started with Firebase hosting follow the following 3 easy steps…
- Change the project folder you want to serve the code and run…
firebase init
This will bring up the Firebase CLI with various options that you can perform but we want Hosting, so press the ↓ on your keyboard and select Hosting: Configure and deploy Firebase Hosting sites
and then press the spacebar and then return to confirm the selection.
- Select
Create a new project
and enter a unqiue project ID
If the project id is already taken, annoyingly the process will quit and you have to start over.
- Confirm your
public
directory and if the project is going to be a SPA
And that’s it!
You will now have a project setup in Firebase which you can deploy assets to using firebase deploy
.
Your URL out-of-the-box will be projectid.web.app
and projectid.firebaseapp.com
but you can add a custom domain name to use instead if you want to.