问题描述
我已经创建了一个 Cloudant 数据库,并且正在尝试将它同步到我的本地 PouchDB。但是,我没有任何成功。
var PouchDB = require('pouchdb');
var find = require('pouchdb-find');
PouchDB.plugin(find);
const cors = require('cors');
var remoteDB = new PouchDB('URL',{"auth": {"username":"USR","password": "PASSWD"}});
console.log('Remote database created Successfully.');
var localDB = new PouchDB('myLocalDB',{ skip_setup: true });
console.log('Local database created Successfully.');
localDB.sync(remoteDB)
remoteDB.info().then(function (info) {
console.log(info);
})
node client.js
Remote database created Successfully.
Local database created Successfully.
(node:28532) UnhandledPromiseRejectionWarning: #<Object>
(node:28532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:28532) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:28532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
也许这行不正确
var remoteDB = new PouchDB('URL',"password": "PASSWD"}});
但是,我查看了 PouchDB,似乎这是调用它的正确方法。任何使用 PouchDB 的人都可以进来看看我在这里做错了什么?
谢谢, 乔
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)