loading...

re: ExpressJS Project Structure VIEW POST

FULL DISCUSSION
 

Something that I found useful is to have a deeper layer inside constrollers that I usually call services.

What controllers do is to receive the request from the client, "manage" the data and pass it to the required services. The idea of services is to "do" the task without depending on the package or framework that is used.

So a controller receives the req object, extract the required info like the body or params and pass plain javascript objects to the services that does not care if we are using express or other tool.
You can find more about this structure in the following articule coreycleary.me/project-structure-f...

 

Hi @hailomym 👋

I 100% agree with the deeper layer. Sometimes I call it services, sometimes I have it split down even further into ORM and other services / business logic.

When I get to the MVC part of this project, I am going to dive into the reasons for this choice, so hang tight 😄

code of conduct - report abuse