Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

313
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda