简体   繁体   English

存储表格数据的用户数据cordova应用程序以进行跨设备同步的最佳方法

[英]Best method for storing tabulated user data cordova app for cross-device sync

So I have an app that I want to build, and it needs a sync feature. 因此,我有一个要构建的应用程序,它需要同步功能。 The basic premise of the app is that the user will be able to store some tabulated data in it. 该应用程序的基本前提是用户将能够在其中存储一些列表数据。 I then want to be able to upload and store that data to a server so they can sync it across devices. 然后,我希望能够将数据上传并存储到服务器,以便他们可以跨设备同步数据。

As the question states, it needs to be cross-platform, specifically Cordova. 正如问题所指出的,它必须是跨平台的,特别是科尔多瓦。 I was thinking about using a MySQL database with tables for each user's data. 我在考虑将MySQL数据库与每个用户数据的表一起使用。 Then use calls on that user-specific table to sync and retrieve data. 然后,使用该用户特定表上的调用来同步和检索数据。 Are there any drawbacks to that approach? 这种方法有什么缺点吗? Better ways of handling it? 更好的处理方法?

Take a look at CouchDB (server) and PouchDB (client). 看一下CouchDB (服务器)和PouchDB (客户端)。 Syncing is made quite easy in these databases. 在这些数据库中,同步非常容易。

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser. PouchDB是一个受Apache CouchDB启发的开源JavaScript数据库,旨在在浏览器中良好运行。

PouchDB was created to help web developers build applications that work as well offline as they do online. PouchDB的创建是为了帮助Web开发人员构建脱机工作以及在线工作的应用程序。

It enables applications to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user's data in sync no matter where they next login. 它使应用程序可以在脱机时在本地存储数据,然后在应用程序重新联机时将其与CouchDB和兼容的服务器同步,从而使用户的数据无论在下次登录时都保持同步。

It is: 它是:

  • Cross Browser : Works in Firefox, Chrome, Opera, Safari, IE and Node.js 跨浏览器 :可在Firefox,Chrome,Opera,Safari,IE和Node.js中使用
  • Lightweight : PouchDB is just a script tag and 46KB (gzipped) 轻量级 :PouchDB只是一个脚本标签,大小为46KB(压缩后)
  • Easy to Learn : Requires some programming knowledge, however PouchDB is a piece of cake to learn. 易于学习 :需要一些编程知识,但是PouchDB是一件容易的事。
  • Open Source : Everything is developed out in the open on Github, contributors always welcome! 开源 :一切都在Github上公开开发,随时欢迎贡献者!

See this SO question and answer to get more in-depth of the architecture of using PouchDB/CouchDB. 请参阅此SO问题和答案,以更深入地了解使用PouchDB / CouchDB的体系结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM