使用Firebase Cloud函数更新托管文件 [英] Using Firebase Cloud Functions to Update Hosted File

查看:80
本文介绍了使用Firebase Cloud函数更新托管文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个使用Angular 4,Firebase和Firebase Cloud Functions的站点.我想做的是将某些数据添加到数据库中时,我想添加,删除或更新Firebase Hosting托管的RSS feed,sitemap和JSON feed中的某些内容.

I am building a site that is using Angular 4, Firebase, and Firebase Cloud Functions. What I am looking to do is when certain data is added to the database I want to add, remove, or update something in an RSS feed, sitemap, and JSON feed which are files hosted with Firebase Hosting.

如果没有手动更新和重新部署项目是不可能的,那么关于如何完成此操作或替代方法的任何建议?

Any suggestions on how to accomplish this or an alternative if it is not possible without manual updates and redeploys of the project?

推荐答案

当前无法基于数据库(或其他动态)触发器将新文件发布(或更新)到Firebase Hosting.

There is currently no way to publish a new (or update a) file to Firebase Hosting based on a database (or other dynamic) trigger.

可能将云函数映射到您网站上的路径(例如/sitemap/feed),在该Cloud Function中生成HTML ,然后在结果上设置缓存头.

What is possible is to map a Cloud Function to a path on your site (e.g. /sitemap or /feed), generate the HTML in that Cloud Function, and then set caching headers on the result.

这篇关于使用Firebase Cloud函数更新托管文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆