Node/NestJS

    NestJS - 의존성 주입(DI) & Providers

    NestJS 프레임워크 사용을 위한 기본 개념에 대해 간략하게 정리해 보고자 한다. 본 포스팅에서는 Providers 와 의존성 주입(Dependency Injection)에 대해 알아보도록 하겠다. 의존성 주입 Providers 1. 의존성 주입 (Dependency Injection) // app.controller.ts 파일 import { Controller, Get } from '@nestjs/common'; import { AppService } from './app.service'; @Controller() export class AppController { constructor(private readonly appService: AppService) {} @Get() getHe..

    NestJS - 기본 구조 & Controllers

    NestJS 프레임워크 사용을 위한 기본 개념에 대해 간략하게 정리해 보고자 한다. 본 포스팅에서는 NestJS의 기본 구조와 Controller 패턴에 대해 알아보도록 하겠다. Setup src/ 디렉토리 구조 Controllers 1. Setup Nest CLI 를 사용해서 프로젝트를 생성해보고자 한다. 우선 npm을 사용해 @nestjs/cli 를 global로 설치해준다. 설치가 완료되었다면, nest new [프로젝트명] 명령어를 통해 보일러 플레이트 코드(Boilerplate code)와 함께 NestJS 프로젝트를 생성할 수 있다. ## Nest CLI 설치 $ npm i -g @nestjs/cli ## Nest 프로젝트 생성 $ nest new [project-name] 보일러..