要使用 Firebase 的 Functions,可先切至 Firebase 下的 Functions 頁面。

Firebase - Getting Started with Cloud Functions

點選開始使用。

Firebase - Getting Started with Cloud Functions

這邊會提示使用 Firebase Functions 的步驟,首先要有 Firebase 指令列工具。

Firebase - Getting Started with Cloud Functions

接著要使用 Firebase 指令列工具初始專案,撰寫專案後再次透過 Firebase 指令列工具部屬專案即可。

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

這邊跟著提示簡單的操作一次,先用 Firebase 指令列初始專案。

firebase init

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

選取使用 Functions 設定。

Firebase - Getting Started with Cloud Functions

選取要使用的 Firebase 專案。

Firebase - Getting Started with Cloud Functions

選取要使用的程式語言。

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

初始完後開啟專案進行修改,撰寫 Firebase Functions。

Firebase - Getting Started with Cloud Functions

撰寫完使用 Firebase 指令列工具進行專案的部屬。

firebase deploy

Firebase - Getting Started with Cloud Functions

Firebase - Getting Started with Cloud Functions

部屬完成 Firebase 的 Functions 資訊主頁會看到我們發布上去的 Firebase Functions。

Firebase - Getting Started with Cloud Functions

訪問 Firebase Functions 對應的網址,可看到 Firebase Functions 正確的運作。

Firebase - Getting Started with Cloud Functions