简体   繁体   中英

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:

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)
  • XMLHttpRequest cannot load http://test.iriscouch.com/todo/ . Origin null is not allowed by Access-Control-Allow-Origin.
  • Uncaught TypeError: Cannot call method 'id' of undefined

Is there something I'm not doing correct?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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