#  nest cli 전역 설치
npm i -g @nestjs/cli

nest -v # 8.0.0

cd packages

# nest new {프로젝트 이름}
nest new backend

주의할점

{
	...
	plugins: ["@typescript-eslint/eslint-plugin", "prettier"], // prettier 추가
	...
}

module.ts

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  imports: [],
  controllers: [AppController],
  providers: [AppService],
	exports: [AppService]
})

// 해당 부분 내부에선 middleware, method 등 을 정의하여 적용할 수 있습니다.
export class AppModule {}

// --- 저는 AppService를 TestService에서 사용하고 싶습니다! ---

// test.service.ts
@Module({
  imports: [AppModule],  // AppService가 정의된 AppModule을 주입받음
  controllers: [TestController],
  providers: [TestService],
	exports: []
})

export class TestModule {}

controller.ts

import { Controller, Get, Post } from "@nestjs/common";
import { TestService } from "./test.service";

// base point: /test
@Controller('test')
export class TestController {
  constructor(private readonly testService: TestService) {}

	// GET /test
  @Get()
  getHello(): string {
    return this.testService.getHello();
  }

	// GET /test:id
	@Get(':id')
  getTest(): string {
    return this.testService.getHello();
  }

	// POST /test
	@Post('')
  addTest(): string {
    return this.testService.getHello();
  }
}

// --------- express --------
app.get('/test', (req, res) => ...)
app.get('/test:id', (req, res) => ...)
app.post('/test', (req, res) => ...)