title: The `uri` parameter to `openUri()` must be a string, got "undefined"
body: <p>I searched a lot about this, but none of them could help me.</p>
  
  <p>When I run my project, I get this error:</p>
  
  <blockquote>
    <p>/home/ali/Desktop/personalitytest-backend/node_modules/mongoose/lib/connection.js:428
            throw new MongooseError('The <code>uri</code> parameter to <code>openUri()</code> must be a ' +
            ^
        MongooseError: The <code>uri</code> parameter to <code>openUri()</code> must be a string, got "undefined". Make sure the first parameter to
    <code>mongoose.connect()</code> or <code>mongoose.createConnection()</code> is a string.</p>
  </blockquote>
  
  <p>My index.js file:</p>
  
  <pre><code>const express = require('express'),
    app = express(),
    mongoose = require('mongoose'),
    rateLimit = new require('express-rate-limit')({
      windowMs: 1000 * 60 * 10,
      max: 500,
      handler: (req, res) =&gt; {
        res.json({
          data: 'Your request was too much, please try again in 10 minutes later.',
          status: 'error'
        })
      }
    });
  const Application = new class {
    constructor() {
      this.setConfig();
      this.setupDB();
      this.setRouters();
      this.setupExpress();
    }
    setConfig() {
      require('dotenv').config();
      app.use(require('helmet')());
      app.use(express.json());
    }
    setupDB() {
      mongoose.Promise = global.Promise;
      mongoose.connect(process.env.DATABASE_URL, { useNewUrlParser: true, useCreateIndex: true });
    }
    setRouters() {
      app.use('/', require('./routes'));
    }
    setupExpress() {
      app.listen(process.env.PORT, () =&gt; console.log(`Listening on port ${process.env.PORT}.`));
      // app.listen(process.env.PORT, process.env.IP, () =&gt; console.log(`Listening on port ${process.env.PORT}.`));
    }
  }
  </code></pre>
  
  <p>My .env file:</p>
  
  <pre><code>PORT=3000
  DATABASE_URL=mongodb://localhost:27017/PersonalityTest
  JWT_SECRETKEY=asfdawetq312etr%!@$qe
  </code></pre>
  
  <p>If I simply write database url in mongoose.connect method, there will be no error.</p>
  
  <p>For example, this doesn't have error:</p>
  
  <pre><code>mongoose.connect("mongodb://localhost:27017/PersonalityTest", { useNewUrlParser: true, useCreateIndex: true });
  </code></pre>