Reputation: 219
I am using PouchDB to sync to a local CouchDb on my Server, and I try to sync a couchdb from my laptop.
The code in my .ts file is as follows:
var localDB = new PouchDB('mylocaldb')
var remoteDB = new PouchDB('http://localhost:5984/easy_water')
localDB.sync(remoteDB, {
live: false,
retry: false
}).on('change', function (change) {
console.log(change);
}).on('paused', function (info) {
console.log(JSON.stringify(info));
}).on('error', function (err) {
console.log(err);
});
console.log("fertig");
and the result in the browser is:
fertig
undefined
undefined
the remoteDatabase exists, so the remoteDatabase is not wrong
Upvotes: 2
Views: 166
Reputation: 31
Does your CouchDB listen to localhost? CORS enabled in CouchDB? Do you need credentials? Try to use 127.0.0.1 instead of localhost. Take a look at the browsers development tools (console). Try to separate sync() into replicate.to() and replicate.from()
Upvotes: 1