nestjs
nestjs 문서 따라하기 #1 (First Step)
너구리킹
2021. 5. 6. 06:43
Nestjs는 "nest new $project_name" command를 이용하여 시작 시 자동으로 file들이 생성되고 아래와 같다.
app.controller.ts | 하나의 route가 있는 기본 controller |
app.controller.spec.ts | controller unit test |
app.module.ts | 이 app의 기본 모듈 |
app.service.ts | 하나의 method를 갖는 service |
main.ts | nestjs의 시작 file |
nestjs는 기본적으로 express를 기반으로 사용하는데 fastify로 변경할 수 있다. (이는 기본 문서를 다 한 후에 알아보도록 하겠다.)
※우리는 nodejs에서 req body로 json을 받기 위해 body-parser를 설정해야만 했다. 하지만 nestjs는 알아서 해준다!
이제 Contoller에 대해 알아보자.