Forked from indolering/gist:b5d95ebd51ff75fa2258
Last active
August 29, 2015 14:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dbname = "dbtemp" + randomName(); | |
var docname = "doc" + randomName(); | |
var remote = 'http://localhost:5984/'+ dbname + ~~(Math.random() * 1000000) | |
var PouchDB = require('pouchdb'); | |
var pouch = new PouchDB(dbname); | |
pouch.put({_id: docname}).then(function() { | |
pouch.put({_id: docname}).then(function() { | |
pouch.replicate.to(remote).on('error', function(err) { | |
console.log('error'); | |
console.log(err); | |
console.log(err.stack); | |
}).on('complete', function (resp) { | |
console.log('complete'); | |
console.log(resp); | |
}).on('change', function (change) { | |
console.log('change'); | |
console.log(change); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment