The latest Firebase web hosting 2020
Before that, please create a folder which will be a place to hold all the project files that we create later. After that, open your terminal (I use the word terminal, command, and opt because I use a Mac, if you are a Windows user, I just say CMD, ctrl, and alt, so please get used to it), then please check whether your firebase is installed on your computer or not, then do a firebase login and then if it is installed you are already logged in via the terminal, then we initialize it to synchronize the project file on your computer with firebase with the following command
$ firebase --version
$ firebase login
$ firebase init
After typing firebase init, then there are several options offered, for now don’t bother. Please choose Hosting because our goal now is to make our project not publish on the local server anymore.
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices. (Press <space> to select)◯ Database: Deploy Firebase Realtime Database Rules◯ Firestore: Deploy rules and create indexes for Firestore◯ Functions: Configure and deploy Cloud Functions❯◯ Hosting: Configure and deploy Firebase Hosting sites◯ Storage: Deploy Cloud Storage security rules
After choosing Hosting, select the firebase project that you created on the website. Next, in the Hosting setup, set it to default by just pressing enter until your Firebase has finished initializing. And automatically there are several files that will be created, please check your previous folder.
✔ Wrote public/404.html
✔ Wrote public/index.htmli Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
✔ Firebase initialization complete!
Furthermore, the index.html file actually contains the and tags. Delete everything, then copy the code below for the index.html file
When finished, we return to the terminal and type the command for hosting our first project.
$ firebase deploy
i deploying hosting
i hosting: preparing public directory for upload...✔ hosting: 2 files uploaded successfully
✔ Deploy complete!Project Console: https://console.firebase.google.com/project/latihanku-9cadc/overviewHosting URL: https://latihanku-9cadc.firebaseapp.com