Deploying to Firebase as the Back End
Firebase is considered a Backend as a Service, which is now part of the Google Cloud Platform while it’s still serving as an independent entity. It offers different services such as hosting, real-time databases, and cloud functions.
- PDF / 598,334 Bytes
- 19 Pages / 504 x 720 pts Page_size
- 26 Downloads / 266 Views
Deploying to Firebase as the Back End Firebase is considered a Backend as a Service, which is now part of the Google Cloud Platform while it’s still serving as an independent entity. It offers different services such as hosting, real-time databases, and cloud functions. In this chapter, I am going to show you how we can deploy our app to Firebase. It’s important to mention that Firebase is not the only option. However, since it’s easy to set up and deploy, I encourage you to use Firebase as our host server. Additionally, we may need to write a bit of back-end logic for our application; therefore, Firebase Function is one of the best choices, in order to leverage serverless architecture and reduce our concerns regarding a back-end system, while the front end will remain our main focus. Last but not least, to persist our data, we will use Firebase Firestore, which gives us the best passivity to store and retrieve our data as quickly and possible with built-in JSON access to each collection and document where needed.
Setting Up Your Account Let’s get started by opening firebase.google.com. Sign in with your Gmail credentials, but if you don’t have any, please continue by first registering a Google account. After you have signed in, continue and hit “GO TO CONSOLE.” You will be redirected to your console where you can see your projects.
© Majid Hajian 2019 M. Hajian, Progressive Web Apps with Angular, https://doi.org/10.1007/978-1-4842-4448-7_2
9
Chapter 2
Deploying to Firebase as the Back End
Creating a Project Now it’s time to add your project; simply click Add project, as shown in Figure 2-1.
Figure 2-1. Firebase console, where you should hit Add Project to create a new project You should see a new view where it is going to ask you about your project details such as your project name. Awesome-Apress-PWA is what I have chosen to name my project. You may need to change your organization or Cloud Firestore location; however, the default setting should be enough to get started. Keep in mind that if you change the Cloud Firestore location, you will not be able to alter it until your project is created. I will leave “Use the default settings for sharing Google Analytics for Firebase data” and “Terms and Condition” checked. Now, it’s time to hit Create project button, as shown in Figure 2-2.
10
Chapter 2
Deploying to Firebase as the Back End
Figure 2-2. Firebase project detail modal It may take several seconds before your project gets ready. As soon as the project is ready, you can continue to your project’s dashboard (see Figure 2-3).
11
Chapter 2
Deploying to Firebase as the Back End
Figure 2-3. After several seconds, the project is ready, so simply click on the “Continue” button to be redirected to the dashboard
Deploying to Firebase We have chosen Firebase as it’s easy to work with for our project, and you’ll see in a minute how painless deployment is with Firebase CLI (Command-Line Interface).
Generating a New Angular App Before we start, we need to generate a new Angular app using Angular C
Data Loading...