Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
Why can´t I connect to my localhost with https?

Hi everyone I try to connect my node.js project in to my localhost server but I can´t.

My Code in app.js:

var bufferkey = require('fs').readFileSync("sslcert/key.pem");
var buffercert = require('fs').readFileSync("sslcert/cert.pem");
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(() => {
       console.log('Database connected successfully ' + config.database);
   }).catch(err => {
       console.log(err);
   });

config/database.js:

module.exports = {
    database: 'mongodb://localhost:27017/gamerforum?ssl=true',
    secret: 'secrets'
}

I do not have any errors but now I can´t go on Port 5000 with https .. why ?

(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
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!