Clean and Consistent Express.js Controllers
khalilstemmler.com
khalilstemmler.com
Today, though, I think this is reinventing the wheel for little benefit. I've moved my own projects to NestJS (https://nestjs.com/) and have found myself paying a lot more attention to logic and application behavior rather than structuring code around a too-thin web server.
NestJS uses Express or Fastify under the hood--because both are great web servers!--but serves to make life a lot more pleasant when using them. The way it strongly encourages the decoupling of application logic (services) and the serving of data to clients (controllers) is a good one and, to me, does a much better job of creating an "enterprise NodeJS and TypeScript" environment than rolling one's own.
Yeah, I'm totally with you on that. Frameworks have the structure we all need but seem to neglect:) Although there is a lot of merit in learning by doing (hence the purpose of the article and my website overall).
Lots of brownfield vanilla Express.js Node APIs can be improved using this pattern.
For simple RESTful todo apps, I'd definitely say you could get away without objects.
But if I was to build a GitLab clone, it would be incredibly difficult to model such a complex problem domain without using a domain model.
From an architectural POV, sometimes frameworks dont solve all your problems, and sometimes they make things harder for you by going against the grain of how your problem domain actually wants to be architected.
Knowing the basics of good software design and how to not use a framework if you're not able to has a lot of merit.
Some domain driven development can actually be idealized as you building your own framework of the problem domain. Why complicate that by adding an additional layer of infrastructure?
It really does depend on the project and evaluating the framework.