How to replicate from CouchDB to PouchDB?-open source projects pouchdb/pouchdb

I’ve set up a local CouchDB database and I’d like to replicate it to a PouchDB database, using JavaScript in a web page running on localhost.

With the code below I get this error:

Origin http://localhost is not allowed by Access-Control-Allow-Origin.

With http:// removed from REMOTE, I don’t get an error, but no docs are shown as replicated.

Looking at IndexedDB databases from Chrome DevTools, I can see the database has been created (but doesn’t appear to have documents).

Running in Chrome 29.0.1535.2 canary.

Can I do this locally, or do I need to set up a remote CouchDB database and enable CORS (as per the CouchDB docs)?

var REMOTE = 'http://127.0.0.1:5984/foo';
var LOCAL = 'idb://foo';

Pouch(LOCAL, function(error, pouchdb){
  if (error) {
    console.log("Error: ", error);
  } else {
    var db = pouchdb;
    Pouch.replicate(REMOTE, LOCAL, function (error, changes) {
      if (error) {
        console.log('Error: ', error);
      }
      else {
        console.log('Changes: ', changes);
        db.allDocs({include_docs: true}, function(error, docs) {
          console.log('Rows: ', docs.rows);
        });
    }});
  }
});