title: Why can´t I connect to my localhost with https?
body: <p>Hi everyone I try to connect my node.js project in to my localhost server but I can´t.</p>
  <p>My Code in app.js:</p>
  <pre><code>var bufferkey = require('fs').readFileSync(&quot;sslcert/key.pem&quot;);
  var buffercert = require('fs').readFileSync(&quot;sslcert/cert.pem&quot;);
  MongoClient.connect(config.database, {
      sslKey: bufferkey,
      sslCert: buffercert,
      sslValidate: false //in case of self-generated certificate
  },
      function(err, db) {
      console.log(err);
      console.log(db);
      db.close();
      },{
      //useNewUrlParser: true,
      useUnifiedTopology: true
      })
     .then(() =&gt; {
         console.log('Database connected successfully ' + config.database);
     }).catch(err =&gt; {
         console.log(err);
     });
  
  </code></pre>
  <p>config/database.js:</p>
  <pre><code>module.exports = {
      database: 'mongodb://localhost:27017/gamerforum?ssl=true',
      secret: 'secrets'
  }
  </code></pre>
  <p>I do not have any errors but now I can´t go on Port 5000 with https .. why ?</p>
  <pre><code>(node:24186) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
  (Use `node --trace-warnings ...` to show where the warning was created)
  Server started on port 5000
  Database connected successfully mongodb://localhost:27017/gamerforum
  </code></pre>