๋ฐ์ํ

์ค์น
npm i -g @nestjs/cli
nest new ckz-back
yarn
** node_modules๊ฐ ์๊ธฐ์ง ์๋๋ค๋ฉด
๋ฐฉ๋ฒ 1)
yarn config set nodeLinker node-modules
๋ฐฉ๋ฒ 2) <- ๋ฐฉ๋ฒ 1๋ก ์ ๋ ๋ ์ฌ์ฉ
1. /์ .yarnrc.yml ํ์ผ ์์ฑ
2. ์๋ ๋ด์ฉ ์์ฑ
nodeLinker: node-modules
3. ์ ๋ ฅํ yarn install
๋๋ฉ์ธ ๊ตฌ์กฐ
src/
โโโ user/
โโโ dto/
โ โโโ create-user.dto.ts
โ โโโ update-user.dto.ts
โโโ user.controller.ts
โโโ user.service.ts
โโโ user.module.ts
โโโ user.entity.ts
โโโ user.repository.ts
๊ตฌ์ฑ ์์
- dto : ๋ฐ์ดํฐ ํํ ์ ์์ ๊ฒ์ฆ (validation)
- module : ์์กด์ฑ ๋ฌถ์ด์ DI ์ปจํ ์ด๋ ๋ฑ๋ก
- controller : HTTP ์์ฒญ ์ฒ๋ฆฌ
- service : ๋น์ฆ๋์ค ๋ก์ง ์์ฑ
- entity : DB ํ ์ด๋ธ ๊ตฌ์กฐ ์ ์์ ๊ด๊ณ ์ค์
- repository : DB ์ ๊ทผ ๋ด๋น (CRUD)
๊ฐ ์์ฑ ๋ช ๋ น์ด
# ํตํฉ ์์ฑ
nest g resource user
# ๊ฐ๋ณ ์์ฑ
nest g module user
nest g controller user
nest g service user
nest g guard auth
nest g interceptor user๋ฐ์ํ