seigel/pouchdb-react-native

error connect to CouchBD

BroshkovD opened this issue · 2 comments

I have code:
import PouchDB from 'pouchdb-react-native'
const remoteDBDocs = new PouchDB('http://admin:admin@127.0.0.1:5984/docs')

console.log('remoteDBDocs',remoteDBDocs);
remoteDBDocs.allDocs()
.then(r => console.log('r', r))
.catch(err=>console.log('err', err))

which give error:
err Object {status: 0, name: "unknown", message: undefined}

Founded solution. Connection string should be
const remoteDBDocs = new PouchDB('http://admin:admin@YOUR_COMPUTER_IP:5984/docs')
(if not work change 127.0.0.1 to your_ip in couchDB settings)
as emulator do not have access to localhost

Founded solution. Connection string should be
const remoteDBDocs = new PouchDB('http://admin:admin@YOUR_COMPUTER_IP:5984/docs')
(if not work change 127.0.0.1 to your_ip in couchDB settings)
as emulator do not have access to localhost