【问题标题】:Reading data from firebase database using cloud functions without relying on events [duplicate]使用云功能从firebase数据库中读取数据而不依赖于事件[重复]
【发布时间】:2018-03-27 16:50:17
【问题描述】:

我已经研究并仅找到了诸如onWrite() 之类的侦听器示例,用于从数据库访问数据的实例,但这些取决于事件。 如何仅在需要时使用这些功能从数据库中读取快照。 提前致谢。

【问题讨论】:

标签: firebase firebase-realtime-database firebase-storage google-cloud-functions


【解决方案1】:

使用 HTTPS 触发器,如下所述: https://firebase.google.com/docs/functions/http-events

另外,请查看此官方示例:https://github.com/firebase/functions-samples/tree/master/quickstarts/time-server

exports.unguessableFunctionName = functions.https.onRequest((req, res) => {
  return doSomething().then(res => {
    res.status(200).send(res);
  });
});

请确保此端点不会成为安全问题

此外,您可以在受保护的(读/写 == false)数据库节点上附加 onWrite 事件,因此只有您可以从控制台触发它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-30
    • 2018-10-30
    • 2017-11-23
    • 2020-09-10
    • 2020-05-15
    • 1970-01-01
    • 2018-08-20
    • 2018-02-01
    相关资源
    最近更新 更多