GraphQL Setup

GraphQL schema context 설정

NestJS GraphQLModule에서 code-first, schema-first, ApolloDriver, context, playground 설정을 프로젝트 운영 방식에 맞춥니다.

Driver

실행 엔진

ApolloDriver를 등록하고 endpoint, introspection, playground 사용 여부를 환경별로 조정합니다.

Schema

스키마 방식

code-first는 decorator 타입을 즉시 재사용할 때 비용이 낮고 schema-first는 SDL 리뷰와 다국어 클라이언트 협업에서 계약 변경을 드러냅니다.

Context

요청 정보

JWT 사용자, request id, DataLoader를 context에 넣어 resolver 간 공통 정보를 공유합니다.

Module

기능 분리

UserModule, PostModule의 resolver와 service를 feature module 단위로 묶습니다.