'DAO and config layer for Node js, Mongo Backend Application?
I am trying to create a node js background worker application that does some additional processing. I am trying to create a DAO layer for the application. But how do I place the configuration in the config layer and then pass the mongo database connection object to other layers such as the DAO layer or maybe even the service layer?
I have been trying to make it work. But couldn't figure it out. Here is my end goal. All the configurations are in one layer such as logging config, AWS config, DB config, middleware config. And I would like to use this config object which returns the database connection object to perform CRUD operations which can be used in any layer I import the object.
Using MongoDB official driver from npmjs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
