RandomAPI / Randomuser.me-Node

Source code that powers randomuser.me
https://randomuser.me
MIT License
1.34k stars 268 forks source link

Exit on startup when MongoDB connection fails #223

Open 10xLaCroixDrinker opened 7 months ago

10xLaCroixDrinker commented 7 months ago

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.