【问题标题】:How to call sub function within export function in a Cloud Function如何在云函数的导出函数中调用子函数
【发布时间】:2017-08-07 01:48:35
【问题描述】:

我有一个函数 getUsers 我正在部署在我的云函数上。

index.js

exports.getUsers = functions.https.onRequest((request, response) => {
   // I want to call computeData function here
});

function computeData(user, x, algo) {

}

我不想导出computeData 函数,只是想在导出函数中调用它。 Cloud Functions for Firebase 中的操作方法是什么?

【问题讨论】:

    标签: node.js firebase google-cloud-functions


    【解决方案1】:

    就像在任何其他函数中一样调用它:

    exports.getUsers = functions.https.onRequest((request, response) => {
        computeData(...)
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-18
      • 1970-01-01
      • 1970-01-01
      • 2021-02-14
      • 2021-09-12
      • 2021-02-10
      相关资源
      最近更新 更多