title: Connect synchronously to mongodb
body: <p>I would like to connect to mongodb first, then run everything else in my application.</p>
  
  <p>To do it I have to write something like:</p>
  
  <pre><code>MongoClient.connect("mongodb://localhost/test", function(err, connection) {
      if (err) { console.error(err); }
      db = connection;
  
      var app = express();
  
      // Include API V1
      require("./apiv1.js")(app, db);
  
      app.listen(3000, function(err) {
          if (err) { console.error(err); } else { console.log("Started on *:3000"); }
      });
  });
  </code></pre>
  
  <p>This makes my app to be completely indented inside the .connect function... Which looks ugly and takes space while I work on my project.</p>
  
  <p>I think the best solution would be have the MongoDB connection synchronous (even because witout the DB connection my app cannot work so why should I do something while it's connecting?) and then run the rest of my code.</p>
  
  <p>How can I do?</p>