NestJS Documentation : https://nestjs.com/
✔ 설치 & 프로젝트 생성
$ npm i -g @nestjs/cli ($ nest -version) $ nest new project-name (which package manager would you ❤ to use? -> yarn)
✔ 폴더 구조
✔ 방법
Nest는 GraphQl application 빌드하는데 2가지 방법을 제공
Code First(코드우선)
autoSchemaFile : 자동 생성될 스키마가 저장될 경로
//@module - import GraphQLModule.forRoot({ autoSchemaFile: 'src/common/graphql/schema.gql', }),
Schema First(스키마 우선)
프로그래밍 언어와 독립적이지만 통합되는 언어, GraphQL SDL(schema definision language)
.graphql 파일에 스키마 직접 작성
GraphQLModule.forRoot({ typePaths: ['./**/*.graphql'], }),
✔ 스텝
$ yarn add @nestjs/graphql graphql apollo-server-express $ nest g module board $ nest g service board $ nest g resolver board $ yarn start dev
http://localhost:3000/graphql 로 확인
✔ 폴더 구조 참고
NestJS Github : https://github.com/nestjs/nest
$ npm install --save @nestjs/typeorm typeorm mysql2
✔ 폴더(파일) 구조 & 생성
**.entity.ts 파일 생성 후 DB에 저장될 엔티티(테이블)의 각 필드 타입을 key: value 형태로 지정
✔ 설정
✔ 단계별 정규화
1. 비정규화
처음에는 모든 데이터가 하나의 테이블에 다 담겨있는 상태
✔ ERDCloud
https://www.erdcloud.com/
✔참고링크
https://www.youtube.com/watch?v=Zshhj0yEenw
https://www.opentutorials.org/course/3883/25259