Reputation: 11391
I am using PouchDB and am trying to replicate from a cloudant server. I also have a nodejs app that proxies the requests to cloudant using the technique described here
var request = require('request')
module.exports = function(pattern, host){
return function(req, res, next){
if(req.url.match(pattern)){
var db_path = req.url.match(pattern)[1]
, db_url = [host, db_path].join('/');
req.pipe(request[req.method.toLowerCase()](db_url)).pipe(res);
}else{
next();
}
}
}
app.use(forward(/\/db\/(.*)/, TARGET_URL));
I am calling replicate on my pouchdb like this:
db.replicate.from('http://localhost/db/myDb', {continuous: true})
Looking in the network tab the first request succeeds, however subsequent requests are made, but instead of calling http://localhost/db/myDb
they are going to http://localhost/db
and thus result in a 404. For some reason it has dropped the name of my database.
Any idea why this is happening?
Upvotes: 1
Views: 912
Reputation: 479
Just try Smileupps. It's a free couchdb hosting service supporting the latest version of CouchDB(1.6.0), compatible with PouchDB as well.
Upvotes: 2
Reputation: 11620
I've heard at least one person say that they found success by syncing PouchDB <-> CouchDB <-> Cloudant. PouchDB offers 1st-class support for CouchDB and IrisCouch; for other providers like Cloudant or Couchbase Sync Gateway, we're working on it.
Upvotes: 0
Reputation: 784
there is some logic that assumes a host/dbname setup, for how you could use a http://localhost/db_myDb
name setup by changing the last line of your app to app.use(forward(/\/db\_(.*)/, TARGET_URL));
though there are some other issues that PouchDB has at the current version with cloudant
Upvotes: 0