firebase init functions
上記を実行するとfunctions
というディレクトリができます。最初のサンプルコードをデプロイしてみます。
const functions = require('firebase-functions'); // // Create and Deploy Your First Cloud Functions // // https://firebase.google.com/docs/functions/write-firebase-functions // exports.helloWorld = functions.https.onRequest((request, response) => { functions.logger.info("Hello logs!", {structuredData: true}); response.send("Hello from Firebase!"); });
firebase deploy --only functions
curl --header Content-Type:"application/json" {エンドポイント}