How to host your Angular 9 webapp with Firebase for free
Sometimes you need to deploy quickly a web application because you have a presentation or simply because you want to launch your new Start-up. In this article, we are going to deploy our angular web app step by step.
I suppose you already created a project from the Firebase console. If not, you can read my article on How to Link your Angular Webapp to Firebase.
1. Installing firebase CLI
In your terminal, run npm i -g firebase-tools to install globally Firebase CLI on your computer.
2. Login to your Google account
Inside of your project directory run this command and follow the instructions:
3. Initialize Firebase
Select Hosting: Configure and deploy Firebase Hosting sites and use an existent project.
Congratulations!!! : You’re ready to deploy your application. Your firebase.json file looks like this :
4. Deploy your application
Before deploying your application, you must build your project to generate the static files to your dist directory.
Simply run ng build — prod — aot to build a production-ready version of your app.
Once your app finished to build, you can deploy it in one command to Firebase hosting : firebase deploy
And VOILA!
Source code : https://github.com/cwebbn/myWebAppMedium/tree/d6687b78b923285b9a6d46a1c1af87d752249c66