Firebase AfterSave功能就像Parse.com一样 [英] Firebase AfterSave function like Parse.com
问题描述
这很好地在解析AfterSave因为我不必担心客户执行这个命令,所以在云中运行是有意义的。现在解析正在关闭,我决定迁移到Firebase。在Firebase中是否有一个平等的功能,或者我的客户需要维护最近发布的帖子?
谢谢
原问题重新解析获取每场最新的记录在Parse.com JS查询
目前无法在Firebase的服务器上运行您的代码。所以,你将不得不想出一个不太直接的云代码映射到一个新的解决方案。在每个客户端上运行功能是一种选择,在廉价的机器人/服务器上运行它是另一个选项。
我会在这里找到几个问题覆盖之前,并在这里链接:
- Firebase和后端逻辑(包括使用nodejs服务器的最近问题) 如何在Firebase中运行服务器端代码?
- 如何使用Firebase处理自动服务器 - 侧边计算?
- Firebase和索引/搜索
-
要记住的一点是,像这样运行服务器并不是你马上想到的编写服务器的类型。其中大部分行为更像是一个机器人,与您的客户端代码一样,与Firebase进行交互。在这种情况下唯一的区别就是它在你控制的环境上运行,所以它可以用提升的凭证运行。
So I was using Parse.com AfterSave cloud code function to keep a list of the most recent Posts relating to a specific location. The reason for this is to get the most recent post for a location without having to search and order the entire list of posts for all locations.
This was nicely done in Parse AfterSave because I didnt have to worry about clients exectuing this command, it made sense for it to run in the cloud. Now that parse is shutting down, I've decided to migrate over to Firebase. Is there an equivilant functionality in Firebase or will my clients need to be maintaining the list of most recent posts?
Thanks
Original question re Parse Get latest record per field in Parse.com JS query
There is currently no way to run your code on Firebase's servers. So you will have to come up with a less-direct mapping of Cloud Code to a new solution. Running the functionality on each client is one option, running it on a cheap "bot"/server is another one.
I'll find a few questions where this has been covered before and link them here:
- Firebase and backend logic (recent question that covers using a nodejs server)
- How would I run server-side code in Firebase?
- How do I use Firebase to handle automatic server-side calculations?
- Firebase and indexing/search
- Server Side Calculation using Firebase (which leads to four more questions about this)
One thing to keep in mind is that running a server like this is not the type of "writing a server" that you're immediately thinking of. Most of these act more like a "bot" that interacts with Firebase in the same way as your client-side code does. The only difference in that case is that it runs on an environment you control, so that it can run with elevated credentials.
这篇关于Firebase AfterSave功能就像Parse.com一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!