Firebase驱动的应用程序与Web服务代码 [英] Firebase-powered app with web service code

查看:257
本文介绍了Firebase驱动的应用程序与Web服务代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



可以说我有一个浏览器应用程序,android应用程序/ iOS它使用Web服务来获取/插入数据,Web服务与数据库进行交谈并将数据返回给客户端。





在此模型中,Firebase数据库位于用户设备上的应用程序和后端代码之间。通过使用这个模型,您仍然可以获得实时同步,安全规则和可伸缩性的所有好处,但也可以在可信环境中运行后端代码。



当然,你也可以选择一个更传统的三层模式,在设备和数据库之间的应用服务器站点。但是在这种情况下,Firebase数据库将不再与您的应用程序直接交互,因此您必须在自己的代码中关注同步的实时方面(如果您需要的话)。



我也建议您阅读


I am planning to use Firebase database and want to know how it fits in to the following scenario.

lets say I have a browser app, android app / iOS which uses Web Services to get / insert data, web services talks to the Data Base and returns data to the client.

This way I have to write code once in my web services and all the clients use that to retrieve and insert data to the database.

If I want to use Firebase, will I be following the same approach of having webservices between the client's and the Firebase DB.

I have done some sample Firebase examples where it it gets data from database directly without web services and in this approach we have to write our logic on each client (Web browser/ android app/ iOs app).

I have looked into this article

https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your-app.html?showComment=1480073224245#c464815735109872173

The Pattern 2 has the server concept but that does not look appropriate in my scenario.

Can I have my web service and Firebase database and get data Synchronization capabilities.

Correct me if I am wrong and please suggest the approach I need to take.

Thank you for your valuable suggestions in advance.

Thanks & regards, Rao Burugula

解决方案

The article you link gives you the most common options for integrating Firebase into your app. Pattern 2 is the easiest way to use the Firebase Database and run your own server-side code:

In this model the Firebase Database sits between the app on the user's device and your back-end code. By using this model, you can still get all the benefits of the realtime synchronization, security rules and scalability, but also have back-end code that runs in a trusted environment.

Of course you can also go for a more traditional three-tier model, where your app server sites between the devices and the database. But in that case the Firebase database won't have direct interaction with your app anymore, so you'll have to take care of the realtime aspects of the synchronization (if you want those) in your own code.

I also recommend reading the Google Cloud documentation on using the Firebase Database and App Engine's Flexible Environments. The architecture described there is the same, but a bit more up-to-date:

这篇关于Firebase驱动的应用程序与Web服务代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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