0

Let's assume we want to develop an ionic app client (or an angular app) and we have an existing mysql database in the backend. How would you best synchronize your data in the frontend with the server's database?

Assume the following 2 approaches:

1) The JSON data is sent to the server via an API and the API is responsible for the data mapping and persistence.

2) We use PouchDB/CouchDB, MongoDB or any other database on the client and want to synchronize it with our mysql server db via replication.

What do you think are the pros and cons of both approaches with regards to below topics?

  • data mapping and flexibility of data models
  • transferred data is JSON text and image files
  • easy setup, maintenance and usage
  • reliable solution
  • secure data transfer (authentication, ...)
  • offline usage of client
  • push notifications
  • other issues?
Thopras
  • 11
  • 2

1 Answers1

-1

I believe you asking more about persisting data from frontend to db and showing data from db on the frontend. The most straightforward way is in option 1. Build a REST API and exchange data in JSON. You can also use Websocket or Stomp intead of REST. Looks like you have taken option 2 from MeteorJS framework where client- side Mongo is used alongside a server-side one.

JSON is now commonly used data standard no matter which protocol you use. You need to understand what do you want from your app and choose solutions based on the requirements. Every single application can have its own specific features requiring extra stuff

Alex Bondar
  • 1,167
  • 4
  • 18
  • 35