Waits for MongoDB connection before starting the application and exits if the connection fails with error message. Currently the application starts but crashes once a request is made to the DB when it fails to connect initially.
The error event that exists is only triggered when there are errors in the connection after its been established. Awaiting the connection and logging on catch will get the failure to connect.
Waits for MongoDB connection before starting the application and exits if the connection fails with error message. Currently the application starts but crashes once a request is made to the DB when it fails to connect initially.
The error event that exists is only triggered when there are errors in the connection after its been established. Awaiting the connection and logging on catch will get the failure to connect.