Using Backend as a Service
In the previous lesson, we saw how to go about creating our own REST API and integrating it with our application. This is a reasonably common approach, but the more popular approach (especially for individual developers or smaller teams) is to use a Backend as a Service or BaaS solution.
Rather than building out the server yourself, and everything that might include like connecting to a database, managing user authentication, scaling for load, and so on - you can use a product with everything ready to go.
One of the most popular options is Firebase, and in the extended version of this course we will actually be building an application that uses Firebase. We will not be diving into how to use Firebase here, but the gist of it is this.
- You create an account for Firebase
- You create a project through their dashboard
- You will be given a configuration object/API key (this key is public)
- You install and use the SDK provided by Firebase to interact with the services they provide e.g. data storage, authentication, cloud functions, and more
Unlike with our own REST API we created where we were manually sending GET
and POST
requests, we wouldn’t actually do this with Firebase. Instead, we use their SDK to make requests like this:
login(credentials: Credentials) {
return signInWithEmailAndPassword(
this.auth,
credentials.email,
credentials.password
);
}