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...
I teach college web development classes in Denmark and I have been messing around on the Internet since the WWW became a thing.
I love simple solutions and humour!
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 😄
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 😄