首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否可以使用firebase在云函数中调用其他API?

是否可以使用firebase在云函数中调用其他API?
EN

Stack Overflow用户
提问于 2018-01-08 18:27:43
回答 1查看 2.8K关注 0票数 2

我想在iOS上设置一些推送警报

当用户在特定时间设置告警时,服务器通过调用Weather API (ex OpenweatherMap)发送天气数据。

是否可以在Firebase中使用云函数

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-01-08 18:34:00

是的,这可以通过request模块来完成。

请参阅Use firebase cloud function to send POST request to non-google server,您可以在其中找到以下内容:

代码语言:javascript
复制
// import the module
var request = require('request');

// make the request
request('put your external url here', function (error, response, body) {
    if (!error && response.statusCode == 200) {
        //here put what you want to do with the request
    }
})

请注意,您必须激活一个付费计划,因为免费计划(Spark plan )只允许“只向Google拥有的服务发出网络请求”

另请注意,您必须先安装请求包,然后才能调用它,如上所示。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48148370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档