我正在实施一个react-native
应用程序。本质上,我想从这个前端应用程序向 Yelp Fusion API 发出 GET 请求,这需要一个私有 API 密钥(我已将其保存在笔记中)。
考虑到带有私钥的 GET 请求应该从服务器端执行,而不是前端react-native
应用程序,我想通过 Google Cloud Functions 或 Firebase Functions 来实现此功能。
本质上,我如何从前端 Javascript 客户端触发这样的事件,以及我需要在 Firebase 或 Google Cloud Functions 上设置什么才能使其工作?
我能够在 Firebase Functions 中编写一个函数,但我不确定如何向 Google Cloud Platform 外部的 URL 写入 GET 请求。我也不知道如何触发请求并从客户端接收数据。
我目前正在 Firebase Functions 中编写一个函数,以便在我的 Firebase 移动应用程序中调用。我有调用该函数的代码,但我不知道如何让该函数与 Firebase 存储交互。
我有一个存储在 Firebase 存储桶中的公共非敏感信息的 JSON 文件 (300KB)。根据用户输入,我将选择此 JSON 文件的特定属性并将结果返回给用户。但是,我无法弄清楚如何从我的 Firebase 函数代码中读取此文件。我该如何执行以下操作?另外,如果有人知道更经济有效的方法,请告诉我!
exports.searchJSON = functions.https.onCall((data, context) => {
const keyword = data.searchTerm
//search the JSON file that is present in the storage bucket
//save the sliced JSON object as a variable
//return this to the user
})
Run Code Online (Sandbox Code Playgroud) node.js google-cloud-storage firebase google-cloud-platform google-cloud-functions