Search code examples
restsynchronizationydn-db

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


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/


Solution

  • Please see the example http://yathit.github.io/ydndb-demo/entity-sync/app.html

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