I'm using nodejs and a mongoDB , and I'm having some connection issues. below is my code:
let url='mongodb://xxx';
let mongoClient = require('mongodb').MongoClient;
mongoClient.connect(url,(err, db)=>{
routes(app, db);
let server = http.Server(app);
server.listen(port,(err)=>{})
})
sometime it seems crushed or hanged, so how to let it reconnect automatically?or is there exits a better solution?
via cityvoice
No comments:
Post a Comment