NestJS · Middle · Question 34 of 75
What's a clean way to keep Prisma or TypeORM details out of business logic?
- 1Use the ORM directly in controllers
- 2Duplicate queries in each service
- ✓Correct answer: Put data access behind repository providers with an interface token, and keep services working with domain types
Explanation
This adds a layer, so it pays off in larger domains or when you need to swap storage or test without a database.