Hola a todos, intento conectar mi proyecto node.js a mi servidor localhost pero no puedo.
Mi código en 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/base de datos.js:
module.exports = { database: 'mongodb://localhost:27017/gamerforum?ssl=true', secret: 'secrets' }No tengo ningún error pero ahora no puedo ir al puerto 5000 con https... ¿por qué?
(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