Curious if others do something similar and group code together by modules or does everyone group by type?
Curious if others do something similar and group code together by modules or does everyone group by type?
controllers/
users.js
teams.js
models/
user.js
team.js
Just have: modules/
users.js
teams.js
Where model and controllers for each function is defined within a single file.I've switched to this convention as well - less context switching of files.
Bugs me to have the order logic spread out in the views, models, controllers, hepers, libs, etc folders.
I'm rolling with a MVP structure that frankly is becoming cumbersome with my current project's size.
appShell/ views/allbaseviewshere viewmodels/controllers or viewmodels for the core views services/baseservices moduels/ account /views/ /viewmodels/ /services/ order /views/ /viewmodels/ /services/ /controllers/ static /css/ /js/ /images/
AppShell contains the app starter page, controllers and util services (showing popups, utility functions etc.) AppShell/Views contains all the UI Skelton for the app (bootstrap main page, etc)
Every folder inside "modules" contains views, controllers (viewmodels) and services belongs to only that module. Account folder contains views for user registeration, sign in, change user profile, etc. etc.
This way you can keep building new moduels in their respective folders without touching the frozen code (already built modules).
Each module talk to outside world using "services". No module can touch anything belongs to other modules but with "services".
Oh between I do group by Type inside of a module.