These are chat archives for vdemedes/mongorito

16th
Dec 2016
Mathieu Ghennassia
@mathieug
Dec 16 2016 09:02
Hello. I have troubles trying to chain mongorito.connect() in my promises chain.
I have this:
const startupPromise = bluebird.resolve();
startupPromise
  .then(() => {
    console.info('Connecting to MongoDB...');
    return mongorito.connect(process.env.MONGO_URI, {
      promiseLibrary: bluebird
    });
  })
  .then((db) => {
    console.info(`Connected to MongoDB database ${db.databaseName}`);
  });
then:
return startupPromise.then(() => {
  return server.listen(process.env.PORT, () => {
    console.info(`Listening on port ${server.address().port} (${app.get('env')})`);
  });
});
And I have "Listening on port..." before "Connected to MongoDB database...".
Mathieu Ghennassia
@mathieug
Dec 16 2016 09:27
@vadimdemedes I think it comes from the fix you made for this issue vadimdemedes/mongorito#93
Mathieu Ghennassia
@mathieug
Dec 16 2016 09:36

Connecting to MongoDB...
Listening on port 3000 (development)
Connected to MongoDB database xxx

but I would like to get

Connecting to MongoDB...
Connected to MongoDB database xxx
Listening on port 3000 (development)