Performance: Code-first approach
MEDIUM IMPACT
This affects the server-side schema generation and initial API response time during GraphQL schema building.
import { GraphQLModule } from '@nestjs/graphql'; GraphQLModule.forRoot({ autoSchemaFile: 'schema.gql', });
import { GraphQLModule } from '@nestjs/graphql'; GraphQLModule.forRoot({ autoSchemaFile: false, typePaths: ['./**/*.graphql'], });
| Pattern | Server Startup Delay | Runtime Parsing | API Response Impact | Verdict |
|---|---|---|---|---|
| Schema-first (parsing .graphql files) | High (50-100ms) | Yes | Slightly slower | [X] Bad |
| Code-first (autoSchemaFile generation) | Medium (startup) | No | Faster | [OK] Good |