There will be myapp.user and myapp.post feature modules:
### hard to re-use the services when there is some logic in the run method of a module
- myapp/
- user/
- controllers/
- services/
- post/
- controllers/
- services/
### One solution I can think of is to change it to this:
- myapp/
- services/
- user/
- user.js
- anotherServiceForUser.js
- post/
- post.js
- anotherServiceForPost.js
- user/
- controllers/
- addUserCtrl.js
- post/
- controllers/
- addPostCtrl.js
myApp.services will house the all the services so they can easily be re-used by other feature modules or another app
### or mix module by feature and module by type
- myapp/
- user/
- controllers/
- services/
- user.js
- anotherServiceForUser.js
- post/
- controllers/
- services/
The feature modules will be:
- myApp.user
- myApp.post
and under those feature modules, there will be module by type:
- myApp.user.services
- myApp.post.services
This way, the folders for a feature module still contains all the services related to it. But the services can easily be re-used.
What is better in your opinion? and why? Or maybe you guys have better suggestions?