Bromoxid
Bromoxid

Reputation: 131

Sync a PouchDB on Nodejs server (without Pochdb-server or Couch)

I want to Sync() the PouchDb on my Nodejs-server with the IndexedDb at frontend.

But : I dont use Couch or Pouchdb-server

on Backend I'm runnig :

var pouch = require('pouchdb')
var db = new pouch('fuu');

test.app.use('/sync'),function(req,res,next){console.log('Woop woop');
db.info(function)(err,info) {return res.send('info')})
});

// same problem with : db.allDocs(..);

on frontend:

var db = new PouchDB('ba');
var remoteCouch = ("http://localhost:3000/sync")

var sync = function() {

        var opts = {live: true};
        db.sync(remoteCouch, opts);}

sync();

But now there is an endless call of 'Woob woob' in the console and nothing sync's ..

Have someone an idea what I'm doing wrong?

Upvotes: 1

Views: 2682

Answers (1)

Dale Harvey
Dale Harvey

Reputation: 1213

You need to correctly map all the urls that PouchDB will use to be able to sync. I aassume your backend is a typo and you are using var db = new PouchDB('fuu') on the backend right?

PouchDB-Server has extracted the url routing logic it uses into another module, https://github.com/pouchdb/express-pouchdb, the README should give you an example of how to do that and you dont need the extra functionality provided by pouchdb-server

Upvotes: 2

Related Questions