Getting Started with Cloud Functions for Firebase using TypeScript
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Watch this video to get started writing functions using TypeScript and deploying them with the Firebase CLI.
If you’re going to write code for Cloud Functions, you definitely need to know about how promises work. Nearly all the functions you write will use promises, and, if you don’t do it correctly, your code may fail in mysterious ways. In this tutorial, you’ll learn the basics of using promises in your HTTP functions.
How do you correctly terminate a background function? You must return a promise that becomes fulfilled or rejected when all the pending work in that function is complete. Let's see what that looks like with a Firestore trigger.
How do you perform multiple items of asynchronous work in Cloud Functions? In this video, you'll see how to chain work sequentially with promises, and also how to manage work in parallel with
Promise.all(). These are the building blocks you'll need to write advanced code with Cloud Functions for Firebase
How does async/await work with TypeScript and ECMAScript 2017?
Did you know that async/await syntax can make your TypeScript (and ECMAScript 2017) easier to read and write? Check out this first of two tutorials to learn async/await for use with Cloud Functions.
Use async/await with TypeScript in Cloud Functions for Firebase
Using async/await syntax with Cloud Functions for Firebase can make your TypeScript and ECMAScript 2017 code easier to read and write. In this part 2 video, Doug shows how to convert some functions that use promises to use async/await instead.