설치
npm i -g @nestjs/cli
프로젝트 생성
nest new project-name
간단 구조 설명
- *.spec.ts : 테스트
- module.ts : 애플리케이션의 루트 모듈
- main.ts : Nest 애플리케이션 인스턴스 생성, Nest 애플리케이션 메인
Swagger
// Swagger 설정
const config = new DocumentBuilder()
.setTitle("Board CRUD")
.setDescription("내 첫 Nest")
.setVersion("1.0")
.addTag("rookedsysc")
.build();
const documents = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("swagger-ui", app, documents);
await app.listen(3000);
Debug Settings
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest Framework",
"runtimeArgs": ["run", "start:debug", "--", "--inspect-brk"],
"autoAttachChildProcesses": true,
"restart": true,
"sourceMaps": true,
"stopOnEntry": false,
"console": "integratedTerminal"
}
]
}
Intellij Debug Setting
- 패키지 매니저 pnpm으로 설정
- Edit Configuration
- 버튼 누르고 npm 선택 후 아래와 같이 설정
- 기타 on save 설정
- dist 폴더 검색 안되게 설정
tsconfig
"strict": true
Cursor 설정
- Formatter -> Default Formatter -> Prettier 설정
- format on save 설정
- Auto Closing Tag 체크 해제