Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- typescript
- bean
- puppeteer
- GraphQL
- JWT
- java
- Spring
- 프로그래머스
- MySQL
- REST API
- html
- 인접행렬
- javascript
- 자료구조
- 알고리즘
- nestjs
- Interceptor
- css
- 인접리스트
- dfs
- node.js
- Deep Dive
- 코딩테스트
- 탐욕법
- Linux
- LifeCycle
- TIL
- winston
- OOP
- Kubernetes
Archives
- Today
- Total
처음부터 차근차근
[NestJS] Request Lifecycle 본문
728x90
NestJS Request Lifecycle
이번 글에서는 NestJS Application에서 어떠한 Request가 오고 나서 Response의 생명주기를 다룹니다.
NestJS는 Node.js의 Express가 해결해주지 못했던 아키텍쳐에 대한 고민을 해결하기 위해 VueJS, AngularJS 등을 참고하여 만든 백엔드 프레임워크입니다.
그렇기 때문에 NestJS에는 클라이언트의 요청을 처리하기 위해 프레임워크가 제공하는 일련의 생명주기가 존재합니다.
위 그림을 예시로 봤을때 큰 틀에서 보면
Middleware -> Guard -> Interceptor -> Pipe -> Controller -> Interceptor
이러한 순서대로 처리됩니다.
그리고 각 단계에서 global, controller, route로 세분화 해서 나누어지는 것을 확인할 수 있습니다.
또한 예외 상황(에러 발생)이 발생할 시에는 @useCatch로 Exception filter에서 처리가 가능합니다.
NestJS 공식 문서 Request lifecycle
더보기
- Incoming request
- Middleware
- 2.1. Globally bound middleware
- 2.2. Module bound middleware
- Guards
- 3.1 Global guards
- 3.2 Controller guards
- 3.3 Route guards
- Interceptors (pre-controller)
- 4.1 Global interceptors
- 4.2 Controller interceptors
- 4.3 Route interceptors
- Pipes
- 5.1 Global pipes
- 5.2 Controller pipes
- 5.3 Route pipes
- 5.4 Route parameter pipes
- Controller (method handler)
- Service (if exists)
- Interceptors (post-request)
- 8.1 Route interceptor
- 8.2 Controller interceptor
- 8.3 Global interceptor
- Exception filters
- 9.1 route
- 9.2 controller
- 9.3 global
- Server response
'FrameWork > NestJS' 카테고리의 다른 글
[NestJS] Guard (0) | 2023.11.27 |
---|---|
[NestJS] Middleware (0) | 2023.11.25 |
[NestJS] Module (1) | 2023.11.24 |
[NestJS] Providers (0) | 2023.11.24 |
[NestJS] Controller (1) | 2023.11.24 |