NestJS · Middle · Question 47 of 75
What's the difference between code-first and schema-first GraphQL in Nest?
- 1Code-first doesn't support mutations
- 2Schema-first works only with REST
- ✓Correct answer: Code-first generates the schema from TypeScript classes and decorators; schema-first writes SDL files and generates TypeScript types from them
Explanation
Code-first keeps one source of truth in TypeScript; schema-first suits teams that design the schema as a contract first.