Hi guy's,
In my current node.js it's Microservices based project,
I'm struggling with folder structure of my boilerplate.
My current boilerplate is something like this:
Main folder is src which consist of different folders (components, bin, helpers,tests).
...components
.............goods
.................goods.controller.js
.................goods.route.js
,................goods.services.js
.................goods.plugins.js
.................goods.repository.js
...bin
...routes
...helpers
...tests
I have not faced any problem yet while using this folder structure.
We have not done seperation of responsibilities principle from starting of this project.
What you think about this boilerplate?
Top comments (7)
Can you give descriptions for what you're files do?
what's the roles of
goods.services.js
goods.plugins.js
good.repository.js?
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?