Tags
- k-디지털트레이닝
- 맛집
- Python
- 전시
- ai_엔지니어링
- 우리fisa
- 17-55
- 수요미식회
- CS231n
- 여행
- SQL
- 650d
- 축복렌즈
- 군산
- 사진
- 건담
- 카페
- 시청
- 전주
- 대만
- fdr-x3000
- 오사카
- 우리에프아이에스
- 대만여행
- 축복이
- 우리fis아카데미
- 제주도
- 해리포터
- 글로벌소프트웨어캠퍼스
- 도쿄
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Today
- Total
Recent Posts
300x250
브렌쏭의 Veritas_Garage
Nest.js 폴더 구조 : MVC 본문
NestJS - A progressive Node.js framework
NestJS is a framework for building efficient, scalable Node.js web applications. It uses modern JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Progr
nestjs.com
일단 모오든 폴더들을 끌어모아서 트리형식으로 만들면 아래와 같은 구조를 가지고 있다.
src
├── auth
│ ├── decorators
│ ├── dtos
│ ├── exceptions
│ ├── guards
│ └── interfaces
├── common
│ ├── decorators
│ ├── dtos
│ ├── entities
│ ├── exceptions
│ ├── helpers
│ └── interfaces
├── config
│ ├── app
│ ├── database
│ │ └── mysql
│ └── jwt
├── database
│ ├── migrations
├── modules
│ ├── item
│ │ ├── brands
│ │ │ ├── entities
│ │ │ ├── interfaces
│ │ │ └── repositories
│ │ └── items
│ │ ├── entities
│ │ ├── interfaces
│ │ └── repositories
│ └── user
│ └── users
│ ├── entities
│ ├── interfaces
│ └── repositories
├── providers
| ├── aws
│ │ ├── s3
│ │ └── sqs
| ├── cache
│ │ └── redis
│ ├── database
│ │ └── postgres
│ └── elasticsearch
│ ├── helpers
│ └── types
├── app.controller.ts
├── app.module.ts
└── main.ts
일단 압도되는 광경이지만, 일단은.. 간단하게 시작하자.
- 눈에 보이는 것은 views 폴더에 넣는다
- 이벤트를 감지하는 것은 controllers 폴더에,
- 그 이벤트를 통해 원하는 액션을 취하는 비즈니스 로직은 controllers 하위의 services 폴더로 간다
뭐가 서비스입니까
일단 DB와 연동되는 부분은 서비스로 간다. 그리고 돈 될만한 핵심 기능이면 전부 서비스로 간다.
뭘 해야 합니까
대부분의 일은 Nestjs가 관리해줄 것이다. 하지만 무엇을 관리당하고 무엇을 할 수 있는지를 알지 못하면 쓰는 의미가 없다. DI라던가.. 일단 저 트리 구조에 맞춰서 잘 작성을 해야 파일 매니지먼트가 원활하게 될 것이다. 니 맘대로 쓴 일기장을 자서전으로 컨버팅해주는 만능툴이 아니다.
우리가 집중해서 볼 부분은 src 폴더 내부 중에서도 일부다. module, controller, service .
'[Project_하다] > [Project_공부]' 카테고리의 다른 글
데이터베이스 스키마 (0) | 2022.03.30 |
---|---|
OOP*( NestJS + TypeORM ) = [ DTO & Entity ] (0) | 2022.03.30 |
Nest.js 로 간다 #20220329 (0) | 2022.03.29 |
Optional Chaining (0) | 2022.03.28 |
Nest.js 를 위한 기초쌓기 #20220328 (0) | 2022.03.28 |
파이프라인 or ERD (0) | 2022.03.28 |
스크랩 / 크롤링 (0) | 2022.03.24 |
Comments