【发布时间】:2021-11-27 23:43:40
【问题描述】:
我在这里遇到了一个小问题。
问题:我正在尝试将数据从连接到 Firestore 的 Firebase Cloud Function(使用 Node.js)发送到我的 react 本机应用程序。我有一个trigger,它在将文档添加到 Firestore 时激活,我想在触发器激活时将数据添加到 redux(在我的应用程序中)。
我知道我必须在如下所示的触发函数中发送信息,但我不确定如何将数据直接发送到 expo 应用程序。
// Example trigger function
exports.createUser = functions.firestore
.document('users/{userId}')
.onCreate((snap, context) => {
// Send information to React Native App
});
我知道将信息发送到数据库,您只需进行 fetch 或 axios 发布,但是从数据库发送信息让我大吃一惊。
我们将不胜感激任何帮助或指出正确的方向。
【问题讨论】:
标签: node.js react-native google-cloud-firestore google-cloud-functions expo