DEV Community

Discussion on: Designing a better architecture for a Node.js API

Collapse
 
allstackdev profile image
AllStackDev 👨‍💻

Yes wanted to do this but realized that it will be repeatation of code so I added a functionality to the
getInstance (init =true) {
init && initScheme();
return mongoose.model("your model name");
}

Thread Thread
 
pacheco profile image
Thiago Pacheco

This is way better, nice job man!
I am going to change the structure of this model soon.