A NestJS app must support both REST and GraphQL endpoints for the same business logic. What is the best way to share service logic?
-
A
Extract business logic into service classes injected into both REST controllers and GraphQL resolvers
-
B
Duplicate the logic in each controller and resolver separately
-
C
Use REST internally and proxy all GraphQL queries to REST endpoints
-
D
Build two separate NestJS apps and share logic via npm package