re: Why should you separate Controllers from Services in Node REST API's? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hey, great question Andrei - I personally tend to favor using plain objects and functions over using classes. In general, I try to follow the mantr...
 

Thank you for your answer!

Initially I was going for plain objects, but then I realized that I would repeat the same functions for almost each service(same goes for controllers).

So I thought I would use a single blueprint service class and in the constructor I would choose the right db class using a factory pattern(that’s at least how I see things, it seems to be working well).

Anyway, I make sure that business logic goes into services, and the controller is the ‘orchestrator’.

Best of luck!

code of conduct - report abuse