DEV Community

Discussion on: Avoiding fat controllers in AdonisJs

Collapse
 
michi profile image
Michael Z

Then you would always get the same instance of ArticleService. In this case it would maybe not be a problem, but it would be inconsistent with the rest of the application I'd assume. But you are definitely right that it was not the best decision to simply new it up in the constructor. A better way would be to use Adonis' automatic dependency injection so it gets newed up automatically and is easy to fake.