controller is c from MVC.
plugins consists of decorators.
repository calls services.
services calls db.
mediators handle complexity of controller.
validations file consist of joi validation.
route consist of routers.
The folder structure is expressive enough to handle most cases, however I find that most of this stuff is unnecessary in small to medium scale applications. For larger applications I suppose that many layers may make sense.
I see that you've grouped together all of the feature related code, however I don't see a goods.test.js file. is the by design?
For most small to medium scale applications, a simple service layer and database model layer is sufficient, so this folder structure would be overkill in those cases.
controller is c from MVC.
plugins consists of decorators.
repository calls services.
services calls db.
mediators handle complexity of controller.
validations file consist of joi validation.
route consist of routers.
I.E
goods.controller.js
goods.mediator.js
goods.plugins.js
goods.repository.js
goods.services.js
goods.validations.js
goods.routes.js
Cool.
Here are my thoughts:
I also write test.
I was thinking about changing it to follow SRP and then DI and make a factory within each and every responsibilities.
What's SRP and DI?
SRP: Seperation of Responsibility Principle.
DI: Dependency Injection
and these are used for?