New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean Code: DataServices #897
Comments
The original design of service is only about data and sql operation. In my view, the business logic should always stay in resolver instead of service. |
Agreed. Data services are used as data sources of Apollo Server, so we should just expose connections to external services such as database, queue, s3, etc., and leave everything else in resolvers. |
Nice PR #2142 💪🏻 |
But this way makes writing unit tests harder. Furthermore, sometime, same business logics are needed by multi resolvers. Services are good places to store those business logic for reuse in such case. |
DataServices such as
userService.ts
andarticleService.ts
have a lot of code in a single file, and as our business logic grows, they become difficult to maintain.The text was updated successfully, but these errors were encountered: