I am building an API service using Nodejs, Expressjs and MongoDB. Also, I am using Mongoose library to deal with database. After going through several blogs on file structuring, I am quiet confused about it. I want help with the file structuring for my project. My "src" folder structure looks like this so far :-
src | |__Controllers | | | |__ admin.js | |__ customer.js |__Models |__Public |__Routes | | | |__ admin.js | |__ customer.js |__Views |__Services | |__admin.services.js |__customer.services.js
My concerns are :-
1) Are Controllers the same as Routes? If not, should they be put in Routes folder?
2) How should my Service files be structured (Am I doing this right?)? Or should each API call get a different service file?
3) Since routes are handling request and response objects, what do we use controllers for? Can we just call "services" from routes and respond from each API route, or am I leaving something behind?