디렉토리 구조
Setup
$ npm i -g @nestjs/cli
$ nest new project-name
- Strict 모드로 프로젝트를 생성하고 싶다면
--strict
플래그와 함께 생성
src/
app.controller.ts |
A basic controller with a single route. |
app.controller.spec.ts |
The unit tests for the controller. |
app.module.ts |
The root module of the application. |
app.service.ts |
A basic service with a single method. |
main.ts |
The entry file of the application which uses the core function NestFactory to create a Nest application instance. |
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();
async
함수를 포함하고 있음
- NestFactory 클래스의 create() 메소드를 이용해 앱 객체 생성
- NestFactory?
- 플랫폼
앱 실행하기
$ npm run start