title: Attach MongoLab to server
body: <p>Currently, I have this config section to run with Heroku's mlab, or locally if it's in development</p>
  
  <pre><code> var env = process.env.NODE_ENV || 'development';
  
   if (env === 'development') {
       process.env.PORT = 3000;
       process.env.MONGODB_URI = 'mongodb://localhost:27017/manage';
   } else if (env === 'test') {
       process.env.PORT = 3000;
       process.env.MONGODB_URI = 'mongodb://localhost:27017/manage-test';
   }
  </code></pre>
  
  <p>which is working for the authentication section of my code.
  However, I have to access another collection within that database, and currently, I'm connecting it locally with</p>
  
  <pre><code>app.get('/auth-home', isLoggedIn, (req, res) =&gt; {
      MongoClient.connect("mongodb://localhost:27017/manage", (err, db) =&gt; {
          db.collection("home", (err, collection) =&gt; {
              collection.find().toArray((err, result) =&gt; {
                  if (err) {
                      return err;
                  }
              });
          });
      });
  });
  </code></pre>
  
  <p>However, this won't connect with mlab since it's localhost.
  So my issue right now is that I'm not sure how to pass that config section of code into my routes as well as connecting to a different collection, and then having it work with Heroku as well.</p>