title: How to use a same DB with 2 different React applications
body: <p>I have to make an offline application that sync with another online app when it can.</p>
  
  <p>I developed <strong>the offline app</strong> using PouchDB. I create this app thanks to the github repo <a href="https://github.com/facebookincubator/create-react-app" rel="nofollow noreferrer">create-react-app</a>. This app is running at localhost:3000. In this app, I create and manage a little DB named "patientDB".</p>
  
  <p>I manage the db with the classical put method like we can see in the documentation:</p>
  
  <pre><code>var db = new PouchDB('patientDB')
  db.put({
  _id: 'dave@gmail.com',
  name: 'David',
  age: 69
  });
  </code></pre>
  
  <p>With the development tool for chrome given by PouchDB, I can see that the DB is working like I want (the documents are created):</p>
  
  <p><a href="https://i.stack.imgur.com/ZSMZd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZSMZd.png" alt="Db overview"></a></p>
  
  <p><strong>The other application</strong> is another React application with a node server. During the development, this app is running at localhost:8080.
  In this app I try to fetch all the docs contained in the "patientDB" with the following code:</p>
  
  <pre><code>const db = new PouchDB('patientDB', { skip_setup: true });
      db.info()
      .then(() =&gt; {
      console.log("DBFOUND")
      db.allDocs({include_docs: true})
      .then(function (result) {
        console.log("RESULT" , result)
      }).catch(function (err) {
        console.log("NOPE")
        console.log(err);
      });
      })
  </code></pre>
  
  <p><strong>My problem</strong> is that I can't get the "patientDB" created with the offline app in the online app. When I do a <code>var db = new PouchDB ('patientDB')</code> it create a new and empty db because it can't find a db which is already present.</p>
  
  <p>I use google chrome to run all my application so I thought that the dbs could be shared.</p>
  
  <p>However I did  little and very simple tests with two html files:</p>
  
  <p><strong>First.html</strong> which initialize a new db with a doc<br>
  <strong>Second.html</strong> which read the db create in First.html<br>
  In this case, I can fetch the doc created with First.html in Second.hmtl even if the are two separated "website".</p>
  
  <p>I think that the application which run at a localhost are like isolated of the rest of the application even if, like I said before, I use the same browser for all my applications...</p>
  
  <p>I don't know what to do or I don't know if it's even possible to do what I want to do. If someone has an idea for me, I would be pleased.</p>
  
  <p><hr>
  <strong>EDIT</strong></p>
  
  <p>I can see why my DBs are not shared:<br>
  When I look at all my local DBs after running an html file I can see the following thing : <br>
  <a href="https://i.stack.imgur.com/3OoRb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3OoRb.png" alt="local db"></a></p>
  
  <p>As we can see, the DBs come from the files <code>_pouch_DB_NAME - file://</code><br></p>
  
  <p>When I check my DB from the application running localy (localhost), I can see this :<br><a href="https://i.stack.imgur.com/IvYnk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IvYnk.png" alt="db from localhost"></a></p>
  
  <p>The DB don't come from file but from <code>localhost:8080</code>
  <br>
  If you know how I can fetch doc from a local db in an app running in a server, it could be really helpful for me!</p>