Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

312
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda