Search code examples
node.jsgoogle-cloud-firestoregoogle-cloud-functionsfirebase-hosting

What is the preferred method to fill my firestore database from an external api?


I have created a firestore database. I am on the Blaze Plan. I am using a 3rd party api with its own nodejs client library. What is the preferred method to use to fill this forestore database with data from this 3rd party api? Firebase hosting or cloud functions? Thank you!


Solution

  • There is no way to run custom code on the Firebase Hosting servers, so Cloud Functions are the only real option between these two. If you want your Cloud Functions to be callable through custom domain, you can do so by connecting them to Firebase Hosting. But the code for connecting your API will still be running on Cloud Functions in that case, you're just using Firebase Hosting to get a nicer-looking URL for calling them.