title: ERR_INVALID_ARG_TYPE error
body: <p>I'm having issues getting data from an API while learning Angular 2. This is the error I'm getting</p>
  
  <blockquote>
    <p>url.js:106 throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'url', 'string', url);
    TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined at Url.parse (url.js:106:11)</p>
  </blockquote>
  
  <p>This is the code I'm working with</p>
  
  <p>index.js</p>
  
  <pre><code>const express = require('express');
  const app = express();
  
  const MongoClient = require('mongodb').MongoClient;
  
  require('dotenv').config();
  
  let database;
  
  MongoClient.connect(process.env.DB_CONN, (err, db) =&gt; {
  
  console.log('connected to mongodb...');
  
  app.listen(3000, () =&gt; {
      database = db;
      console.log('listening on port 3000...')
  });
  });
  
  app.get('/contacts', (req, res) =&gt; {
  const contactsCollection = database.collection('contacts');
  
  contactsCollection.find({}).toArray((err, docs) =&gt; {
      if(err) {
          console.log(err);
      }
      return res.json(docs);
  });
  });
  </code></pre>
  
  <p>.env</p>
  
  <pre><code>DB_CONN=mongodb://admin:password@ds117931.mlab.com:17931/dem-contact
  </code></pre>
  
  <p>I do not understand the error and the only url I have is in my env file since I'm using mlab mongodb. What's wrong with my code?</p>