설정

typescript 기반 프로젝트를 생성한다.

ormconfig.json 화일에 데이터베이스 관련 정보를 수정한다.

엔티티 설정

entity 폴더 아래에 hero 엔티티 생성

power 엔티티 생성. hero와 power는 one to many 관계를 가진다.

테스트 데이터 생성

index.ts에 데이터를 생성하여 테스트한다.

graphql 설정

graphql 라이브러리 설치. merge-graphql-schemas 는 모듈화를 위해서 필요

graphql plugin 설치

IDEA settings에서 plugin 으로 들어가서 marketplace 에서 graphql 플러그인을 찾아서 설치한다.

graphql 서버 세팅

Database 연동없이 graphql 서버를 구동한다. typeDef, resolver는 모듈화를 한다.

typeDef 폴더를 만들고 아래에 index.ts hero.graphqls 파일을 차례대로 만든다.

resolver 폴더를 생성하고 index.ts와 hero.resoler.ts를 생성한다.

graphql Server 를 index.ts 맨아래에서 구동한다.

Comments are closed.