Always make a note for the Routes, the database schema before starting to make any API.
For me only(learning purpose): How i wrote the code (file wise):
- server.js
- app.js
- api->routes->products.js ->orders.js
- connect database(mongodb/mongoose) through the app.js
- with the above step start doing Models for the (M(models)V(view i.e. we don't render any view here)C(controllers i.e. routes detailed) architeture)
- connect the models to the controllers/routers
- for every routes made configure the database actions with proper response to them
- do authentication things such as signup and signin