-1

By simple, I really meant simple. I'm not working with express or react or anything like that, I just have a script that does some runs some simple API requests and uses a database to store some information. I was wondering what a good project structure should look like, since I did do some research and all the sites have some good examples, however I just can't apply them in my use case. It's always nice to have a clean and straightforward setup so you don't confuse yourself, hence why I am asking this question.

crypthusiast0
  • 407
  • 2
  • 4
  • 19
  • 1
    https://github.com/MoathShraim/Nodejs-rest-api-project-structure-Express#:~:text=Node.js%2C%20Express%20and%20MongoDB%20Project%20Structure%20This%20is,good%20structure%20practices%20based%20on%20clean%20MVC%20Architecture. – Mohit Kushwaha Jul 24 '21 at 04:11

1 Answers1

1

This is my personal preference but the project structure I use is as follows: |-- controller -> This will be the entry point of a function. It does all the validation, exception handling and suppies the code to the next layer. |-- service -> this is the main application logic where we do all the calculations and operations on the supplied data. Every controller must have atleast one service while there can be utilities for internal service.

If you are working with database, you will need these two layers as well: |-- models -> The model is the structure for the database schema and will have description of the same. |-- dal(data access layer) -> this is the layer where we usually interact with the databases and perform CRUD operations.

Hope this answers helps. Happy to help :)