yathit / ydn-db

Javascript database module for Indexeddb, Web SQL and localStorage storage mechanisms supporting version migration, advanced query, SQL and transaction.
Apache License 2.0
503 stars 41 forks source link

how to sync data from ydn-db web app to backend server? #86

Closed asicfr closed 8 years ago

asicfr commented 8 years ago

With ydn-dn, i want to automatically synchronise data from my web app with my REST back end. I read the documentation and searched in examples but i cannot make it work. https://yathit.github.io/ydn-db/synchronization.html http://dev.yathit.com/api/ydn/db/schema.html#sync

I tried to define a schema with sync configuration like that :

var schema = { stores: [ { name: 'contact', keyPath: 'id', Sync: { format: 'rest', transport: service, Options: { baseUri: '/' } } } ] }; and created a function for transport :

var service = function(args) { console.log("contact synch"); }; but my service function is never called. I certainly misunderstood how YDN-db work, but i didn't found any example.

To complete, here is a jsfiddle : http://jsfiddle.net/asicfr/y7sL7b3j/

Thx for your help.

yathit commented 8 years ago

There is an example http://yathit.github.io/ydndb-demo/entity-sync/app.html

Old example http://yathit.github.io/sprintly-service/playground.html from https://github.com/yathit/sprintly-service

asicfr commented 8 years ago

Cool, thx.