I'm making a scalable REST-API, but I barely find articles on advanced node.js application structures in terms of a big application, since most of them are using simple starter projects.
I'm using the "folder-by-feature" structure, based on this article and this answer.
My question: what is the better structure of the solutions bellow?
1. Keep the routes in a separate folder:
src
product
index.js
product.spec.js
routes
index.js
product.js
user.js
user
index.js
user.spec.js
2. Put the route into its corresponding folder:
src
product
index.js
product.route.js
product.spec.js
user
index.js
user.route.js
user.spec.js
Using the routes in the index.js
files.
Are there any better solutions?
Any article about advanced, scalable node project structures would be appreciated!