title: Simple connection to mongodb in react app
body: <p>I have created simple react app using 'create-react-app'. This app contains form, validation and bootstrap things. Nothing fancy yet works like a charm.</p>
  <p>I have also signed up to mongo to get a free cluster so I can send over some data to. So I have this URL:</p>
  <pre><code>mongodb+srv://matt:passwprd@cluster0-jlasm.mongodb.net/test
  </code></pre>
  <p>Now, all I want to do is to send JSON data from the form to mongo but I don't know how.</p>
  <p>When I am following tutorials and installing MongoDB, mongoose or whatever packages and adding basic setup for future CRUD operations:</p>
  <pre><code>var MongoClient = require('mongodb').MongoClient
    , assert = require('assert');
  
  // Connection URL
  var url = 'mongodb+srv://mattOsuch:brainhub123@cluster0-jlasm.mongodb.net/test';
  
  // Use connect method to connect to the server
  MongoClient.connect(url, function(err, db) {
    assert.equal(null, err);
    console.log(&quot;Connected successfully to server&quot;);
  
    db.close();
  });
  </code></pre>
  <p>The entire application crashes:</p>
  <pre><code>./node_modules/mongodb-core/lib/uri_parser.js
  Module not found: Can't resolve 'dns' in 'C:\Users\Mateusz\Desktop\brainhub\node_modules\mongodb-core\lib'
  </code></pre>
  <p>I used to send data using jQuery or mysql_query in PHP but I can't overcome this problem. In other words I want to achieve functionality like presented in this video: <a href="https://www.youtube.com/watch?v=Jsqz5op4fH8" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Jsqz5op4fH8</a> So as I said, simple data update.</p>
  <p>My suspicion is that react-scripts server listener has some sort of conflict with mongo but I am not sure.</p>
  <p>Please help me because I am loosing my nerves.</p>