Reputation: 493
There is already similar question at Folder structure for a Node.js project but answer to that post seems to be purely for nodejs, does not consider the angularjs.
I dont need view folder mentioned in above post as I will be using view inside app folder for angularjs.
Can anyone please help me with better folder structure...like where to put route logic, where to business logic. folder should be segregated by functionality or feature...etc?
Upvotes: 2
Views: 8977
Reputation: 621
If you are building application using both Node JS and Angular JS, then your folder structure should be like below.
/App - Folder that Contains your angular js applications
/AppName - Folder containing files related to specific application.
/contorllers - Folder containing controllers related to specific app.
/services - Folder containing services related to specific app.
app.js - JS file containing your routes handled by this app, application initialization and configs.
/views - Folder containing html view files.
/commonDirectives - Folder containing common directives.
/commonViews - Folder containing common html view files.
coreApp.js - JS file containing your core app initialization, configurations and routes that are common for all apps (for example dashboard, aboutus, contactus etc.)
/server - Folder containing your node js server.
/libs - Folder containing your custom libraries.
/models - Folder containing schemas for your database models (like in mongo db -define different schemas for different document).
/routes - Folder containing routes handled by node js server.
/plugins - Folder containing your custom plugins (like database plugin, processRequest plugin etc.)
/spec - Folder containing specifications.
/tests - Folder containing test applications
server.js - JS file containing your server logic.
package.json - Package.json file.
Upvotes: 9