title: MongoDB not saving data because "Uncaught ReferenceError: require is not defined"
body: <p>I'm testing NodeJS and MongoDB. So, I've created an html file with a form. </p>
  
  <p><strong>That form grabs the user input and tries to save it to a Mongo database.</strong></p>
  
  <p>I've tried manually inserting the values into mongo using the console and it works.</p>
  
  <p>I've started node server writing down <code>node</code> at the terminal, inside my EC2 amazon web server. <strong>I've already installed both (node and mongo).</strong></p>
  
  <p><strong>The form looks like this:</strong></p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="email" name="email" class="form-control" id="email"&gt;
  &lt;input type="submit" onclick="avisoPago.insertarDB()" class="btn btn-danger" value="Avisar del pago ahora"&gt;&lt;/input&gt;
  </code></pre>
  
  <p><strong>And here's what I'm trying to do in the js file:</strong></p>
  
  <pre><code>"use strict";
  const mongojs = require("mongojs");
  //string connection
  const db = mongojs("localhost:27017/pagosDB",["pagosDB"]);
  
  var avisoPago = {
      email: function () {    return $('#email').val();   },    
      insertarDB: function(){
              db.pagos.insert({
                  email:"nadie@example.com",
                  //I've also tried email:"this.email()",
                  estado: "pendiente"
              });
      }
  
  }
  </code></pre>
  
  <p><strong>I've also installed mongojs</strong> (using <code>npm install mongojs</code>).</p>
  
  <p>But I get this error <code>avisos-de-pago.js:4 Uncaught ReferenceError: require is not defined</code></p>
  
  <p>Note: Line 4 of the JS file is: <code>const mongojs = require("mongojs");</code>)</p>
  
  <p>I know thata there is something very silly that I'm missing here...</p>