1
Good evening, everyone!
I’m starting in the area and as a first goal I decided to create a simple e-commerce, only every time I start my server, it runs a connection to the database unnecessarily, I got the flea behind my ear, because after all, it would be safe? I don’t have to close the connection every time I make an appointment or something?
If anyone can explain me these concepts and tals, follow my code
Below follows the section where I make the connection, what I wanted to know would be more a concept even, not to make silly mistakes in the future, It may even be that my question does not make much sense for experienced staff
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/didixo', {useNewUrlParser: true}).then(function(){
console.log("Conectado a base de dados")
}).catch(function(err){
console.log("Erro ao conectar a base de dados: " + err)
})
/questions/ask#
Friend, I really appreciate the tips, I have been researching about the ESLINT, because I did not know it, I will use it for sure, thank you!!
– José Augusto Megres