title: How to access and display database (MongoDB) information in the view (HTML)?
body: <p>I have a database on mlab.com that I can successfully post to using this code in my controller:</p>
  
  <pre><code>app.post('/dashboard', function(req, res) {
    var newEvent = req.body;
    db.collection('events').insertOne(newEvent, function(err, doc) {
      if (err) {
        error(res, "Failed to create new event.");
      } else {
        res.sendFile('views/dashboard.html', { root: '.' });
      }
    });
  });
  </code></pre>
  
  <p>At the localhost:8080/dashboard URL, I have a form where a user can enter in event data.</p>
  
  <p>Now my question is, how do I get that data to be able to display it in the HTML? For example, displaying a list of all the events entered at that same /dashboard URL but in a different location on the page. I believe I need to do something along these lines:</p>
  
  <pre><code>app.get('/dashboard', function (req, res) {
    db.collection('events').findOne( {
      eventName : req.body.eventName
    }, function(err, doc) {
      // ????
    });
  });
  </code></pre>
  
  <p>But then how do I display the data I got back in the HTML view? </p>
  
  <p>Any help would be greatly appreciated because I've been stuck on this for quite some time now.</p>