简体   繁体   English

使用Google Chrome V22将数据从CouchDB复制到PouchDB,以便在Windows 7上进行离线存储

[英]Replicate data from CouchDB to PouchDB for offline storage on windows 7 using google Chrome V22

I am trying to replicate data from CouchDB to PouchDB for offline storage using the code to pull data from CouchDB: 我正在尝试使用从CouchDB中提取数据的代码将数据从CouchDB复制到PouchDB以进行离线存储:

db.replicate.from('http://test.iriscouch.com/todo','idb://todo', function (err, changes) {
if (err) {
    console.log(err);
}
else {
    console.log(changes);
}});
$scope.loadTodos(response.rows);

I get these errors: 我收到这些错误:

  • Failed to load resource: the server responded with a status of 405 (Method Not Allowed) 无法加载资源:服务器响应状态为405(方法不允许)
  • XMLHttpRequest cannot load http://test.iriscouch.com/todo/ . XMLHttpRequest无法加载http://test.iriscouch.com/todo/ Origin null is not allowed by Access-Control-Allow-Origin. Access-Control-Allow-Origin不允许使用null。
  • Uncaught TypeError: Cannot call method 'id' of undefined 未捕获的TypeError:无法调用未定义的方法'id'

Is there something I'm not doing correct? 有什么东西我做得不对吗?

要使PouchDB与CouchDB通信,它需要在同一个域上运行,或者需要在Pouch和Couch之间安装CORS-Proxy,这是由于浏览器强制实施的原始策略,CouchDB的下一个版本将有希望本地支持这个,但同时对于一个生产网站,我会发现最简单的方法是使用nginx让小袋和沙发在同一个域上运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM