【发布时间】:2019-06-07 01:28:16
【问题描述】:
我正在尝试在 Firebase 云函数中控制台记录来自 Firestore 的文档。有人可以帮我写代码吗?
export const getUser = functions.https.onRequest((req, res) => {
const uid = req.query.uid
corsHandler(req, res, () => {
onUpdate(res, uid)
})
})
function onUpdate(res, uid) {
functions.database.ref(`/profiles/{profileId}`).onUpdate((change, context) => {
const profileId = uid
console.log('BEFORE: ', change.before.val())
res.send('OK')
})
}
【问题讨论】:
-
欢迎来到 Stack Overflow!我们需要更多信息来为您提供适当的帮助,包括具体出了什么问题。请参阅How do I ask a good question?、Stack Overflow question checklist 和 Creating a Minimal, Complete, and Verifiable example。
标签: typescript firebase google-cloud-firestore google-cloud-functions