시작하기

// 설치
npm i -g @nestjs/cli

// 프로젝트 시작하기
nest new 

// command 확인하기
nest

// dev 모드 서버 실행 : package.json 의 script 확인!
npm run start:dev

추가 설치할 패키지들

npm i class-validator class-transformer
npm i @nestjs/mapped-types

설치되었을 때 나오는 화면 귀엽…ㅋ

Untitled

NestJS의 구성


main.ts

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

main.ts를 확인하면 위의 내용이 기본적으로 세팅되어 있다.

기본 함수 bootstrap() 가 존재하는데 이름은 변경 가능.