【发布时间】:2021-05-27 12:45:15
【问题描述】:
我在网络和 Google 文档上找不到如何自动检索 Json 数据并将其保存在 Firebase 数据库中。
我的目标:每小时调用一个外部 JSON 并将数据保存在我的 Firebase 实时数据库中。
有可能吗?
非常感谢您的帮助。
【问题讨论】:
标签: database firebase firebase-realtime-database cron
我在网络和 Google 文档上找不到如何自动检索 Json 数据并将其保存在 Firebase 数据库中。
我的目标:每小时调用一个外部 JSON 并将数据保存在我的 Firebase 实时数据库中。
有可能吗?
非常感谢您的帮助。
【问题讨论】:
标签: database firebase firebase-realtime-database cron
您可以使用 Cloud Functions 来执行此操作,它是您在 Google 服务器上运行的代码的 sn-ps。你可以run such functions on a schedule,就像这个例子中的链接:
exports.scheduledFunction = functions.pubsub.schedule('every 5 minutes').onRun((context) => {
console.log('This will be run every 5 minutes!');
return null;
});
在该函数中,您可以运行任何您想要的进程。
Cloud Functions for Firebase 仅限于运行 Node.js 代码,但还有其他可以运行更多语言的解决方案(例如 Google Cloud Run)。
【讨论】: