diff --git "a/_posts/2024-03-26-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260.md" "b/_posts/2024-03-26-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260.md" new file mode 100644 index 0000000..0eaa6ce --- /dev/null +++ "b/_posts/2024-03-26-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260.md" @@ -0,0 +1,210 @@ +--- +layout: post +title: "NestJS 설치 및 시작하기" +date: 2024-03-29 09:57:00 +0900 +categories: nestjs +description: > + NestJS를 설치하고 기본 구조를 살펴보며 NestJS를 사용해서 프로젝트를 시작해봅시다. +image: /assets/img/2024-03-29-NestJS-설치-및-시작하기/nestjs-logo.png +--- + +1. TOC +{:toc} + +## 시작하기 전에 + +NestJS를 설치하기 위해서는 Node.jsnpm이 설치되어 있어야 합니다. 만약 설치되어 있지 않다면 [Node.js 공식 홈페이지](https://nodejs.org/en/download)에서 Node.js를 설치해주세요.\ +(Node.js를 설치하면 npm도 함께 설치됩니다.) + +
+Node.js 공식 다운로드 페이지에 들어가면 아래와 같은 화면이 보이게 됩니다. + +Node.js 공식 홈페이지 + +LTS 버전과 Current 버전이 있는데, LTS 버전은 장기 지원되는 안정적인 버전이고 Current 버전은 최신 기능이 추가된 버전입니다.\ +Current 버전에서는 예상치 못한 에러가 발생할 수 있으므로 보통은 LTS 버전을 권장합니다. + +그 다음으로 본인이 사용중인 컴퓨터 환경을 선택하고 다운로드 해주시면 됩니다! + +> 참고로 필자는 ARM 아키텍처를 사용한 애플 실리콘이 탑재된 macOS를 사용하고 있어 위 화면처럼 선택했습니다. + +
+설치가 완료되었다면 터미널을 열어 아래 명령어를 입력해 Node.js와 npm이 정상적으로 설치되었는지 확인해봅시다. + +~~~zsh +# file: "terminal" +node -v +~~~ + +node 버전 확인 + +
+~~~zsh +# file: "terminal" +npm -v +~~~ + +npm 버전 확인 + +
+명령어를 입력했을 때 Node.js와 npm의 버전이 출력된다면 정상적으로 설치가 완료된 것입니다. + +그럼 이제 NestJS를 설치하러 가봅시다! +
+ +## NestJS 설치하기 + +[NestJS 공식 문서](https://docs.nestjs.com)를 참고하여 해당 포스트를 작성하니 공식 문서를 함께 참고하시면서 따라와주세요. 😊 + +
+먼저 NestJS를 설치할 디렉토리를 생성하고 해당 디렉토리로 이동합니다. + +저는 간단하게 `nest-project`라는 이름으로 디렉토리를 생성해봤습니다. + +디렉토리 생성 +
+
+
+그리고 해당 디렉토리 위치에서 아래 명령어를 입력해 NestJS CLI[^1]를 설치합니다. +
+
+~~~zsh +# file: "NestJS CLI 설치" +npm i -g @nestjs/cli +~~~ + +> 여기서 `-g` 옵션은 글로벌 설치를 의미합니다. 글로벌 설치를 하게 되면 어디서든 해당 패키지를 사용할 수 있습니다. + +
+NestJS CLI를 설치하고 `nest`명령어를 입력하면 아래와 같이 사용할 수 있는 명령어들이 출력됩니다. + +nest 명령어 확인 +
+
+
+이제 `nest new {project-name}` 명령어를 통해 새로운 NestJS 프로젝트를 생성해봅시다. + +필자는 `blog-nest`라는 이름으로 프로젝트를 생성해보겠습니다. + +nest new 명령어로 프로젝트 생성 + +패키지 매니저를 선택하라는 메시지가 나오는데 필자는 `npm`을 선택했습니다.\ +(화살표 키를 이용해 선택하고 엔터키를 누르면 됩니다.) +
+
+
+ +프로젝트 생성중\ +프로젝트 생성중인 모습 +{:.figcaption} + +
+프로젝트 생성이 완료되면 아래와 같이 성공적으로 프로젝트가 생성되었다고 메세지가 출력되네요! + +프로젝트 생성 성공 + +
+이제 `code .` 명령어를 통해 해당 프로젝트 디렉토리를 VSCode에서 열어 구조를 살펴보러 가봅시다. + +## NestJS 기본 프로젝트 구조 살펴보기 + +VSCode에서 프로젝트 열기 + +VSCode에서 자세히 살펴보면 위 사진처럼 `blog-nest`라는 프로젝트 디렉토리가 생성되었고, 그 안에 노드 모듈과 src/ 디렉토리 안에 NestJS의 핵심 파일이 생성된 것을 확인할 수 있습니다. + +
+~~~none +nest-project +└─ blog-nest + ├─ src + │ ├─ app.controller.spec.ts + │ ├─ app.controller.ts + │ ├─ app.module.ts + │ ├─ app.service.ts + │ └─ main.ts + ├─ test + │ ├─ app.e2e-spec.ts + │ └─ jest-e2e.json + ├─ .eslintrc.js + ├─ .prettierrc + ├─ README.md + ├─ nest-cli.json + ├─ package-lock.json + ├─ package.json + ├─ tsconfig.build.json + └─ tsconfig.json +~~~ +project tree +{:.figcaption} + +
+핵심 파일들의 간략한 개요: + +| 파일명 | 설명 | +|:---|:---| +| `app.controller.ts` | 컨트롤러 파일로, 클라이언트의 요청을 받아 처리하는 역할을 합니다. | +| `app.controller.spec.ts` | 컨트롤러의 테스트 코드를 작성하는 파일입니다. | +| `app.module.ts` | 애플리케이션의 루트 모듈입니다. | +| `app.service.ts` | 서비스 파일로, 비즈니스 로직을 처리하는 역할을 합니다. | +| `main.ts` | Nest 애플리케이션 인스턴스를 생성하기 위해 핵심 함수 `NestFactory`를 사용하는 애플리케이션의 엔트리 파일입니다. | + +
+NestJS로 프로젝트를 진행하기 위해선 반드시 Controller, Service, Module을 이해하고 있어야 합니다...!\ +지금 모두 설명하기에는 무리가 있으니 이에 대한 자세한 내용은 다음 포스트에서 다루도록 하겠습니다. + +## 프로젝트 실행하기 + +이제 프로젝트를 실행해 볼텐데, `package.json` 파일을 열어봅시다. + +
+package.json 파일 + +`scripts` 부분을 보면 다양한 명령어들이 적혀있는데, `npm run`과 함께 해당 명령어를 입력하면 옵션에 따라 다르게 서버를 실행할 수 있습니다. + +일단은 `npm run start:dev` 명령어를 입력해 개발 서버를 실행해봅시다. + +dev 옵션으로 서버를 실행하면 파일이 변경될 때마다 자동으로 서버가 재시작됩니다.\ +개발중에는 위 명령어를 사용하여 서버를 실행하는 것을 추천합니다. +
+
+
+혹시나 아래와 같은 에러가 발생한다면 `cd {프로젝트 이름}` 명령어를 통해 프로젝트 디렉토리 안으로 이동 한 후 명령어를 입력해주세요! + +missing script error + +~~~ +npm ERR! Missing script: "start:dev" +npm ERR! +npm ERR! To see a list of scripts, run: +npm ERR! npm run + +npm ERR! A complete log of this run can be found in: /Users/nicodora/.npm/_logs/2024-03-28T12_55_04_707Z-debug-0.log +~~~ +
+
+서버를 성공적으로 실행했다면 아래와 같이 서버가 정상적으로 실행되었다는 메세지가 출력됩니다. + +서버 실행 성공 +
+
+
+브라우저에서 [`http://localhost:3000`](http://localhost:3000) 혹은 `http://127.0.0.1:3000`으로 접속하면 아래와 같이 `Hello World!`라는 메세지가 출력되는 것을 확인할 수 있습니다. + +localhost 접속 + +## 마치며 + +오늘은 NestJS를 설치하고 기본 구조를 살펴보며 `Hello World!`서버를 실행시켜봤습니다. +
+
+NestJS를 설치하고 단 한 줄의 코드를 작성하지 않았음에도 간단하게 서버를 구동할 수 있었습니다. 👍\ +(역시 킹갓 NestJS 😎) + +다음 포스트에서는 NestJS의 핵심인 Controller, Service, Module에 대해 자세히 알아보고 직접 코드를 작성해보는 시간을 갖도록 하겠습니다. + +그럼 다음 포스트에서 뵙겠습니다! 뾰로롱~ +
+
+프리렌 움짤1 + +[^1]: CLI(Command Line Interface)는 명령어를 통해 프로그램을 제어하는 인터페이스를 의미합니다. NestJS CLI는 NestJS 프로젝트를 생성하고 관리하는 명령어를 제공합니다. \ No newline at end of file diff --git a/_site/404.html b/_site/404.html index be52c5c..a6f55ef 100644 --- a/_site/404.html +++ b/_site/404.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); diff --git a/_site/about/index.html b/_site/about/index.html index 13fa604..853f153 100644 --- a/_site/about/index.html +++ b/_site/about/index.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" new file mode 100644 index 0000000..8affe4f Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" new file mode 100644 index 0000000..4b67814 Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" new file mode 100644 index 0000000..4672782 Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" new file mode 100644 index 0000000..2e9e8af Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" new file mode 100644 index 0000000..948d03e Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" new file mode 100644 index 0000000..172a734 Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" new file mode 100644 index 0000000..9c4abe6 Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" new file mode 100644 index 0000000..d57108c Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" new file mode 100644 index 0000000..a8e94ce Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" differ diff --git "a/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" new file mode 100644 index 0000000..24218ae Binary files /dev/null and "b/_site/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" differ diff --git "a/_site/drafts/2024-03-21-\354\264\210\354\225\210 \355\205\214\354\212\244\355\212\270.html" "b/_site/drafts/2024-03-21-\354\264\210\354\225\210 \355\205\214\354\212\244\355\212\270.html" index b8a133c..9532073 100644 --- "a/_site/drafts/2024-03-21-\354\264\210\354\225\210 \355\205\214\354\212\244\355\212\270.html" +++ "b/_site/drafts/2024-03-21-\354\264\210\354\225\210 \355\205\214\354\212\244\355\212\270.html" @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); diff --git a/_site/feed.xml b/_site/feed.xml index 2610911..3d8d87d 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1,4 +1,234 @@ -Jekyll2024-03-28T17:28:07+09:00http://localhost:4000/feed.xmlNicoDora백엔드 개발을 중심으로 포스트 하고 있는 NicoDora의 블로그입니다.NicoDoraNestJS를 선택한 이유 (NestJS란?)2024-03-22T21:20:00+09:002024-03-22T21:20:00+09:00http://localhost:4000/nestjs/2024/03/22/NestJS%EB%A5%BC-%EC%84%A0%ED%83%9D%ED%95%9C-%EC%9D%B4%EC%9C%A0 +Jekyll2024-03-28T22:32:09+09:00http://localhost:4000/feed.xmlNicoDora백엔드 개발을 중심으로 포스트 하고 있는 NicoDora의 블로그입니다.NicoDoraNestJS 공식 문서와 함께 시작하기2024-03-26T21:20:00+09:002024-03-26T21:20:00+09:00http://localhost:4000/nestjs/2024/03/26/NestJS-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0 +
  • 시작하기 전에
  • +
  • NestJS 설치하기
  • +
  • NestJS 기본 프로젝트 구조 살펴보기
  • +
  • 프로젝트 실행하기
  • +
  • 마치며
  • + + +

    시작하기 전에

    + +

    NestJS를 설치하기 위해서는 Node.jsnpm이 설치되어 있어야 합니다. 만약 설치되어 있지 않다면 Node.js 공식 홈페이지에서 Node.js를 설치해주세요.
    +(Node.js를 설치하면 npm도 함께 설치됩니다.)

    + +


    +Node.js 공식 다운로드 페이지에 들어가면 아래와 같은 화면이 보이게 됩니다.

    + +

    Node.js 공식 홈페이지

    + +

    LTS 버전과 Current 버전이 있는데, LTS 버전은 장기 지원되는 안정적인 버전이고 Current 버전은 최신 기능이 추가된 버전입니다.
    +Current 버전에서는 예상치 못한 에러가 발생할 수 있으므로 보통은 LTS 버전을 권장합니다.

    + +

    그 다음으로 본인이 사용중인 컴퓨터 환경을 선택하고 다운로드 해주시면 됩니다!

    + +
    +

    참고로 필자는 ARM 아키텍처를 사용한 애플 실리콘이 탑재된 macOS를 사용하고 있어 위 화면처럼 선택했습니다.

    +
    + +


    +설치가 완료되었다면 터미널을 열어 아래 명령어를 입력해 Node.js와 npm이 정상적으로 설치되었는지 확인해봅시다.

    + +
    # file: "terminal"
    +node -v
    +
    + +

    node 버전 확인

    + +


    +
    # file: "terminal"
    +npm -v
    +
    + +

    npm 버전 확인

    + +


    +명령어를 입력했을 때 Node.js와 npm의 버전이 출력된다면 정상적으로 설치가 완료된 것입니다.

    + +

    그럼 이제 NestJS를 설치하러 가봅시다! +

    + +

    NestJS 설치하기

    + +

    NestJS 공식 문서를 참고하여 해당 포스트를 작성하니 공식 문서를 함께 참고하시면서 따라와주세요 😊

    + +


    +먼저 NestJS를 설치할 디렉토리를 생성하고 해당 디렉토리로 이동합니다.

    + +

    저는 간단하게 nest-project라는 이름으로 디렉토리를 생성해봤습니다.

    + +

    디렉토리 생성 +
    +
    +
    +그리고 해당 디렉토리 위치에서 아래 명령어를 입력해 NestJS CLI1를 설치합니다. +
    +

    +
    # file: "NestJS CLI 설치"
    +npm i -g @nestjs/cli
    +
    + +
    +

    여기서 -g 옵션은 글로벌 설치를 의미합니다. 글로벌 설치를 하게 되면 어디서든 해당 패키지를 사용할 수 있습니다.

    +
    + +


    +NestJS CLI를 설치하고 nest명령어를 입력하면 아래와 같이 사용할 수 있는 명령어들이 출력됩니다.

    + +

    nest 명령어 확인 +
    +
    +
    +이제 nest new {project-name} 명령어를 통해 새로운 NestJS 프로젝트를 생성해봅시다.

    + +

    필자는 blog-nest라는 이름으로 프로젝트를 생성해보겠습니다.

    + +

    nest new 명령어로 프로젝트 생성

    + +

    패키지 매니저를 선택하라는 메시지가 나오는데 필자는 npm을 선택했습니다.
    +(화살표 키를 이용해 선택하고 엔터키를 누르면 됩니다.) +
    +
    +

    + +

    프로젝트 생성중
    +프로젝트 생성중인 모습

    + +


    +프로젝트 생성이 완료되면 아래와 같이 성공적으로 프로젝트가 생성되었다고 메세지가 출력되네요!

    + +

    프로젝트 생성 성공

    + +


    +이제 code . 명령어를 통해 해당 프로젝트 디렉토리를 VSCode에서 열어 구조를 살펴보러 가봅시다.

    + +

    NestJS 기본 프로젝트 구조 살펴보기

    + +

    VSCode에서 프로젝트 열기

    + +

    VSCode에서 자세히 살펴보면 위 사진처럼 blog-nest라는 프로젝트 디렉토리가 생성되었고, 그 안에 노드 모듈과 src/ 디렉토리 안에 NestJS의 핵심 파일이 생성된 것을 확인할 수 있습니다.

    + +


    +
    nest-project
    +└─ blog-nest
    +   ├─ src
    +   │  ├─ app.controller.spec.ts
    +   │  ├─ app.controller.ts
    +   │  ├─ app.module.ts
    +   │  ├─ app.service.ts
    +   │  └─ main.ts
    +   ├─ test
    +   │  ├─ app.e2e-spec.ts
    +   │  └─ jest-e2e.json
    +   ├─ .eslintrc.js
    +   ├─ .prettierrc
    +   ├─ README.md
    +   ├─ nest-cli.json
    +   ├─ package-lock.json
    +   ├─ package.json
    +   ├─ tsconfig.build.json
    +   └─ tsconfig.json
    +
    +

    project tree

    + +


    +핵심 파일들의 간략한 개요:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    파일명설명
    app.controller.ts컨트롤러 파일로, 클라이언트의 요청을 받아 처리하는 역할을 합니다.
    app.controller.spec.ts컨트롤러의 테스트 코드를 작성하는 파일입니다.
    app.module.ts애플리케이션의 루트 모듈입니다.
    app.service.ts서비스 파일로, 비즈니스 로직을 처리하는 역할을 합니다.
    main.tsNest 애플리케이션 인스턴스를 생성하기 위해 핵심 함수 NestFactory를 사용하는 애플리케이션의 엔트리 파일입니다.
    + +


    +NestJS로 프로젝트를 진행하기 위해선 반드시 Controller, Service, Module을 이해하고 있어야 합니다…!
    +지금 모두 설명하기에는 무리가 있으니 이에 대한 자세한 내용은 다음 포스트에서 다루도록 하겠습니다.

    + +

    프로젝트 실행하기

    + +

    이제 프로젝트를 실행해 볼텐데, package.json 파일을 열어봅시다.

    + +


    +package.json 파일

    + +

    scripts 부분을 보면 다양한 명령어들이 적혀있는데, npm run과 함께 해당 명령어를 입력하면 옵션에 따라 다르게 서버를 실행할 수 있습니다.

    + +

    일단은 npm run start:dev 명령어를 입력해 개발 서버를 실행해봅시다.

    + +

    dev 옵션으로 서버를 실행하면 파일이 변경될 때마다 자동으로 서버가 재시작됩니다.
    +개발중에는 위 명령어를 사용하여 서버를 실행하는 것을 추천합니다. +
    +
    +
    +혹시나 아래와 같은 에러가 발생한다면 cd {프로젝트 이름} 명령어를 통해 프로젝트 디렉토리 안으로 이동 한 후 명령어를 입력해주세요!

    + +

    missing script error

    + +
    npm ERR! Missing script: "start:dev"
    +npm ERR! 
    +npm ERR! To see a list of scripts, run:
    +npm ERR!   npm run
    +
    +npm ERR! A complete log of this run can be found in: /Users/nicodora/.npm/_logs/2024-03-28T12_55_04_707Z-debug-0.log
    +
    +


    +
    +서버를 성공적으로 실행했다면 아래와 같이 서버가 정상적으로 실행되었다는 메세지가 출력됩니다.

    + +

    서버 실행 성공 +
    +
    +
    +브라우저에서 http://localhost:3000 혹은 http://127.0.0.1:3000으로 접속하면 아래와 같이 Hello World!라는 메세지가 출력되는 것을 확인할 수 있습니다.

    + +

    localhost 접속

    + +

    마치며

    + +

    오늘은 NestJS를 설치하고 기본 구조를 살펴보며 Hello World!서버를 실행시켜봤습니다. +
    +
    +NestJS를 설치하고 단 한 줄의 코드를 작성하지 않았음에도 간단하게 서버를 구동할 수 있었습니다 👍
    +(역시 킹갓 NestJS 😎)

    + +

    다음 포스트에서는 NestJS의 핵심인 Controller, Service, Module에 대해 자세히 알아보고 직접 코드를 작성해보는 시간을 갖도록 하겠습니다.

    + +

    그럼 다음 포스트에서 뵙겠습니다! 뾰로롱~ +
    +
    +프리렌 움짤1

    + +
    +
      +
    1. +

      CLI(Command Line Interface)는 명령어를 통해 프로그램을 제어하는 인터페이스를 의미합니다. NestJS CLI는 NestJS 프로젝트를 생성하고 관리하는 명령어를 제공합니다. 

      +
    2. +
    +
    ]]>
    NicoDora
    NestJS를 선택한 이유 (NestJS란?)2024-03-22T21:20:00+09:002024-03-22T21:20:00+09:00http://localhost:4000/nestjs/2024/03/22/NestJS%EB%A5%BC-%EC%84%A0%ED%83%9D%ED%95%9C-%EC%9D%B4%EC%9C%A0
  • NestJS란?
  • NestJS를 선택하기 전에
  • NestJS를 선택한 이유
  • diff --git a/_site/forms-by-example.html b/_site/forms-by-example.html index 1c54822..4ec9692 100644 --- a/_site/forms-by-example.html +++ b/_site/forms-by-example.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); diff --git a/_site/incomplete/2024/03/19/The-first-test-post.html b/_site/incomplete/2024/03/19/The-first-test-post.html index 18af02a..cca21db 100644 --- a/_site/incomplete/2024/03/19/The-first-test-post.html +++ b/_site/incomplete/2024/03/19/The-first-test-post.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); @@ -455,7 +455,7 @@

    - + diff --git a/_site/incomplete/index.html b/_site/incomplete/index.html index 89cd0ec..6ff71ba 100644 --- a/_site/incomplete/index.html +++ b/_site/incomplete/index.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); diff --git a/_site/index.html b/_site/index.html index 75346d6..c97774c 100644 --- a/_site/index.html +++ b/_site/index.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); @@ -231,6 +231,84 @@

    NicoDora 블로그

    + + + + + + + + + + +

    @@ -317,6 +395,17 @@

    All Posts

    +
  • + NestJS 공식 문서와 함께 시작하기 + +
  • + + + + + + +
  • NestJS를 선택한 이유 (NestJS란?) @@ -337,6 +426,15 @@

    NestJS

    +
  • + NestJS 공식 문서와 함께 시작하기 + +
  • + + + + +
  • NestJS를 선택한 이유 (NestJS란?) diff --git "a/_site/nestjs/2024/03/22/NestJS\353\245\274-\354\204\240\355\203\235\355\225\234-\354\235\264\354\234\240.html" "b/_site/nestjs/2024/03/22/NestJS\353\245\274-\354\204\240\355\203\235\355\225\234-\354\235\264\354\234\240.html" index f762b1d..2211b19 100644 --- "a/_site/nestjs/2024/03/22/NestJS\353\245\274-\354\204\240\355\203\235\355\225\234-\354\235\264\354\234\240.html" +++ "b/_site/nestjs/2024/03/22/NestJS\353\245\274-\354\204\240\355\203\235\355\225\234-\354\235\264\354\234\240.html" @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); @@ -425,7 +425,7 @@

    지금부터는

    - + diff --git "a/_site/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" "b/_site/nestjs/2024/03/26/NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" similarity index 50% rename from "_site/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" rename to "_site/nestjs/2024/03/26/NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" index 69ce4ba..ae4bdb9 100644 --- "a/_site/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" +++ "b/_site/nestjs/2024/03/26/NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.html" @@ -33,7 +33,7 @@ NestJS 공식 문서와 함께 시작하기 | NicoDora - + @@ -59,7 +59,7 @@ - + @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); @@ -192,14 +192,41 @@ / - drafts + nestjs
  • / - 2024-03-26-NestJS-시작하기.html + + + 2024 + +
  • + +
  • + + / + + + 03 + +
  • + +
  • + + / + + + 26 + +
  • + +
  • + + / + NestJS-시작하기.html
  • @@ -216,7 +243,7 @@ -
    +

    @@ -273,50 +300,238 @@

    - 1. TOC -{:toc} +
      +
    1. 시작하기 전에
    2. +
    3. NestJS 설치하기
    4. +
    5. NestJS 기본 프로젝트 구조 살펴보기
    6. +
    7. 프로젝트 실행하기
    8. +
    9. 마치며
    10. +
    + +

    시작하기 전에

    -## 시작하기 전에 +

    NestJS를 설치하기 위해서는 Node.jsnpm이 설치되어 있어야 합니다. 만약 설치되어 있지 않다면 Node.js 공식 홈페이지에서 Node.js를 설치해주세요.
    +(Node.js를 설치하면 npm도 함께 설치됩니다.)

    -NestJS를 설치하기 위해서는 Node.jsnpm이 설치되어 있어야 합니다. 만약 설치되어 있지 않다면 [Node.js 공식 홈페이지](https://nodejs.org/en/download)에서 Node.js를 설치해주세요.\ -(Node.js를 설치하면 npm도 함께 설치됩니다.) +


    +Node.js 공식 다운로드 페이지에 들어가면 아래와 같은 화면이 보이게 됩니다.

    -
    -Node.js 공식 다운로드 페이지에 들어가면 아래와 같은 화면이 보이게 됩니다. +

    Node.js 공식 홈페이지

    -Node.js 공식 홈페이지 +

    LTS 버전과 Current 버전이 있는데, LTS 버전은 장기 지원되는 안정적인 버전이고 Current 버전은 최신 기능이 추가된 버전입니다.
    +Current 버전에서는 예상치 못한 에러가 발생할 수 있으므로 보통은 LTS 버전을 권장합니다.

    -LTS 버전과 Current 버전이 있는데, LTS 버전은 장기 지원되는 안정적인 버전이고 Current 버전은 최신 기능이 추가된 버전입니다.\ -Current 버전에서는 예상치 못한 에러가 발생할 수 있으므로 보통은 LTS 버전을 권장합니다. +

    그 다음으로 본인이 사용중인 컴퓨터 환경을 선택하고 다운로드 해주시면 됩니다!

    -그 다음으로 본인이 사용중인 컴퓨터 환경을 선택하고 다운로드 해주시면 됩니다! +
    +

    참고로 필자는 ARM 아키텍처를 사용한 애플 실리콘이 탑재된 macOS를 사용하고 있어 위 화면처럼 선택했습니다.

    +
    -> 참고로 필자는 ARM 아키텍처를 사용한 애플 실리콘이 탑재된 macOS를 사용하고 있어 위 화면처럼 선택했습니다. +


    +설치가 완료되었다면 터미널을 열어 아래 명령어를 입력해 Node.js와 npm이 정상적으로 설치되었는지 확인해봅시다.

    -
    -설치가 완료되었다면 터미널을 열어 아래 명령어를 입력해 Node.js와 npm이 정상적으로 설치되었는지 확인해봅시다. +
    # file: "terminal"
    +node -v
    +
    -~~~zsh -# file: "terminal" -node -v -~~~ +

    node 버전 확인

    -node 버전 확인 +


    +
    # file: "terminal"
    +npm -v
    +
    -
    -~~~zsh -# file: "terminal" -npm -v -~~~ +

    npm 버전 확인

    -npm 버전 확인 +


    +명령어를 입력했을 때 Node.js와 npm의 버전이 출력된다면 정상적으로 설치가 완료된 것입니다.

    -
    -명령어를 입력했을 때 Node.js와 npm의 버전이 출력된다면 정상적으로 설치가 완료된 것입니다.\ -그럼 이제 NestJS를 설치하러 가봅시다! -
    +

    그럼 이제 NestJS를 설치하러 가봅시다! +

    + +

    NestJS 설치하기

    + +

    NestJS 공식 문서를 참고하여 해당 포스트를 작성하니 공식 문서를 함께 참고하시면서 따라와주세요 😊

    + +


    +먼저 NestJS를 설치할 디렉토리를 생성하고 해당 디렉토리로 이동합니다.

    + +

    저는 간단하게 nest-project라는 이름으로 디렉토리를 생성해봤습니다.

    + +

    디렉토리 생성 +
    +
    +
    +그리고 해당 디렉토리 위치에서 아래 명령어를 입력해 NestJS CLI1를 설치합니다. +
    +

    +
    # file: "NestJS CLI 설치"
    +npm i -g @nestjs/cli
    +
    + +
    +

    여기서 -g 옵션은 글로벌 설치를 의미합니다. 글로벌 설치를 하게 되면 어디서든 해당 패키지를 사용할 수 있습니다.

    +
    + +


    +NestJS CLI를 설치하고 nest명령어를 입력하면 아래와 같이 사용할 수 있는 명령어들이 출력됩니다.

    + +

    nest 명령어 확인 +
    +
    +
    +이제 nest new {project-name} 명령어를 통해 새로운 NestJS 프로젝트를 생성해봅시다.

    + +

    필자는 blog-nest라는 이름으로 프로젝트를 생성해보겠습니다.

    + +

    nest new 명령어로 프로젝트 생성

    + +

    패키지 매니저를 선택하라는 메시지가 나오는데 필자는 npm을 선택했습니다.
    +(화살표 키를 이용해 선택하고 엔터키를 누르면 됩니다.) +
    +
    +

    + +

    프로젝트 생성중
    +프로젝트 생성중인 모습

    + +


    +프로젝트 생성이 완료되면 아래와 같이 성공적으로 프로젝트가 생성되었다고 메세지가 출력되네요!

    + +

    프로젝트 생성 성공

    + +


    +이제 code . 명령어를 통해 해당 프로젝트 디렉토리를 VSCode에서 열어 구조를 살펴보러 가봅시다.

    + +

    NestJS 기본 프로젝트 구조 살펴보기

    + +

    VSCode에서 프로젝트 열기

    + +

    VSCode에서 자세히 살펴보면 위 사진처럼 blog-nest라는 프로젝트 디렉토리가 생성되었고, 그 안에 노드 모듈과 src/ 디렉토리 안에 NestJS의 핵심 파일이 생성된 것을 확인할 수 있습니다.

    + +


    +
    nest-project
    +└─ blog-nest
    +   ├─ src
    +   │  ├─ app.controller.spec.ts
    +   │  ├─ app.controller.ts
    +   │  ├─ app.module.ts
    +   │  ├─ app.service.ts
    +   │  └─ main.ts
    +   ├─ test
    +   │  ├─ app.e2e-spec.ts
    +   │  └─ jest-e2e.json
    +   ├─ .eslintrc.js
    +   ├─ .prettierrc
    +   ├─ README.md
    +   ├─ nest-cli.json
    +   ├─ package-lock.json
    +   ├─ package.json
    +   ├─ tsconfig.build.json
    +   └─ tsconfig.json
    +
    +

    project tree

    + +


    +핵심 파일들의 간략한 개요:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    파일명설명
    app.controller.ts컨트롤러 파일로, 클라이언트의 요청을 받아 처리하는 역할을 합니다.
    app.controller.spec.ts컨트롤러의 테스트 코드를 작성하는 파일입니다.
    app.module.ts애플리케이션의 루트 모듈입니다.
    app.service.ts서비스 파일로, 비즈니스 로직을 처리하는 역할을 합니다.
    main.tsNest 애플리케이션 인스턴스를 생성하기 위해 핵심 함수 NestFactory를 사용하는 애플리케이션의 엔트리 파일입니다.
    + +


    +NestJS로 프로젝트를 진행하기 위해선 반드시 Controller, Service, Module을 이해하고 있어야 합니다…!
    +지금 모두 설명하기에는 무리가 있으니 이에 대한 자세한 내용은 다음 포스트에서 다루도록 하겠습니다.

    + +

    프로젝트 실행하기

    + +

    이제 프로젝트를 실행해 볼텐데, package.json 파일을 열어봅시다.

    + +


    +package.json 파일

    + +

    scripts 부분을 보면 다양한 명령어들이 적혀있는데, npm run과 함께 해당 명령어를 입력하면 옵션에 따라 다르게 서버를 실행할 수 있습니다.

    + +

    일단은 npm run start:dev 명령어를 입력해 개발 서버를 실행해봅시다.

    + +

    dev 옵션으로 서버를 실행하면 파일이 변경될 때마다 자동으로 서버가 재시작됩니다.
    +개발중에는 위 명령어를 사용하여 서버를 실행하는 것을 추천합니다. +
    +
    +
    +혹시나 아래와 같은 에러가 발생한다면 cd {프로젝트 이름} 명령어를 통해 프로젝트 디렉토리 안으로 이동 한 후 명령어를 입력해주세요!

    + +

    missing script error

    + +
    npm ERR! Missing script: "start:dev"
    +npm ERR! 
    +npm ERR! To see a list of scripts, run:
    +npm ERR!   npm run
    +
    +npm ERR! A complete log of this run can be found in: /Users/nicodora/.npm/_logs/2024-03-28T12_55_04_707Z-debug-0.log
    +
    +


    +
    +서버를 성공적으로 실행했다면 아래와 같이 서버가 정상적으로 실행되었다는 메세지가 출력됩니다.

    + +

    서버 실행 성공 +
    +
    +
    +브라우저에서 http://localhost:3000 혹은 http://127.0.0.1:3000으로 접속하면 아래와 같이 Hello World!라는 메세지가 출력되는 것을 확인할 수 있습니다.

    + +

    localhost 접속

    + +

    마치며

    + +

    오늘은 NestJS를 설치하고 기본 구조를 살펴보며 Hello World!서버를 실행시켜봤습니다. +
    +
    +NestJS를 설치하고 단 한 줄의 코드를 작성하지 않았음에도 간단하게 서버를 구동할 수 있었습니다 👍
    +(역시 킹갓 NestJS 😎)

    + +

    다음 포스트에서는 NestJS의 핵심인 Controller, Service, Module에 대해 자세히 알아보고 직접 코드를 작성해보는 시간을 갖도록 하겠습니다.

    + +

    그럼 다음 포스트에서 뵙겠습니다! 뾰로롱~ +
    +
    +프리렌 움짤1

    + +
    +
      +
    1. +

      CLI(Command Line Interface)는 명령어를 통해 프로그램을 제어하는 인터페이스를 의미합니다. NestJS CLI는 NestJS 프로젝트를 생성하고 관리하는 명령어를 제공합니다. 

      +
    2. +
    +
    -## NestJS 설치하기
    @@ -352,6 +567,8 @@

    + + @@ -359,6 +576,27 @@

    + + diff --git a/_site/nestjs/index.html b/_site/nestjs/index.html index a7c6523..40e8023 100644 --- a/_site/nestjs/index.html +++ b/_site/nestjs/index.html @@ -96,7 +96,7 @@ w._search = { DATA_URL: '/assets/sitedata.json?no-cache', STORAGE_KEY: 'mini-search/', - INDEX_KEY: 'index--2024-03-28T17:28:07+09:00', + INDEX_KEY: 'index--2024-03-28T22:32:09+09:00', }; w._clapButton = true; }(window); @@ -207,6 +207,82 @@ + + + + + + + + +

    diff --git a/_site/sitemap.xml b/_site/sitemap.xml index 9ba7c14..7734345 100644 --- a/_site/sitemap.xml +++ b/_site/sitemap.xml @@ -3,6 +3,22 @@ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> + + http://localhost:4000/nestjs/2024/03/26/NestJS-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0.html + + 2024-03-26T21:20:00+09:00 + + + + weekly + + + + 0.5 + + + + http://localhost:4000/nestjs/2024/03/22/NestJS%EB%A5%BC-%EC%84%A0%ED%83%9D%ED%95%9C-%EC%9D%B4%EC%9C%A0.html diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" new file mode 100644 index 0000000..8affe4f Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/create-directory.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" new file mode 100644 index 0000000..4b67814 Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/install-success.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" new file mode 100644 index 0000000..4672782 Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/localhost.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" new file mode 100644 index 0000000..2e9e8af Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/missing-script-error.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" new file mode 100644 index 0000000..948d03e Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-command.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" new file mode 100644 index 0000000..172a734 Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nest-new-project.png" differ diff --git "a/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nestjs-logo.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nestjs-logo.png" similarity index 100% rename from "assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nestjs-logo.png" rename to "assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nestjs-logo.png" diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" new file mode 100644 index 0000000..9c4abe6 Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/new-project-create-loading.png" differ diff --git "a/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/node-version-check.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/node-version-check.png" similarity index 100% rename from "assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/node-version-check.png" rename to "assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/node-version-check.png" diff --git "a/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nodejs-download-page.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nodejs-download-page.png" similarity index 100% rename from "assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/nodejs-download-page.png" rename to "assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/nodejs-download-page.png" diff --git "a/assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/npm-version-check.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/npm-version-check.png" similarity index 100% rename from "assets/img/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260/npm-version-check.png" rename to "assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/npm-version-check.png" diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" new file mode 100644 index 0000000..d57108c Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/open-vscode.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" new file mode 100644 index 0000000..a8e94ce Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/package-json-scripts.png" differ diff --git "a/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" new file mode 100644 index 0000000..24218ae Binary files /dev/null and "b/assets/img/2024-03-29-NestJS-\354\204\244\354\271\230-\353\260\217-\354\213\234\354\236\221\355\225\230\352\270\260/server-start-success.png" differ diff --git "a/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.md" "b/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.md" deleted file mode 100644 index e9609ae..0000000 --- "a/drafts/2024-03-26-NestJS-\354\213\234\354\236\221\355\225\230\352\270\260.md" +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: post -title: "NestJS 공식 문서와 함께 시작하기" -date: 2024-03-26 21:20:00 +0900 -categories: nestjs -description: > - NestJS를 설치하고 기본 구조를 살펴보며 NestJS를 사용해서 프로젝트를 시작해봅시다. -image: /assets/img/2024-03-26-NestJS-시작하기/nestjs-logo.png ---- - -1. TOC -{:toc} - -## 시작하기 전에 - -NestJS를 설치하기 위해서는 Node.jsnpm이 설치되어 있어야 합니다. 만약 설치되어 있지 않다면 [Node.js 공식 홈페이지](https://nodejs.org/en/download)에서 Node.js를 설치해주세요.\ -(Node.js를 설치하면 npm도 함께 설치됩니다.) - -
    -Node.js 공식 다운로드 페이지에 들어가면 아래와 같은 화면이 보이게 됩니다. - -Node.js 공식 홈페이지 - -LTS 버전과 Current 버전이 있는데, LTS 버전은 장기 지원되는 안정적인 버전이고 Current 버전은 최신 기능이 추가된 버전입니다.\ -Current 버전에서는 예상치 못한 에러가 발생할 수 있으므로 보통은 LTS 버전을 권장합니다. - -그 다음으로 본인이 사용중인 컴퓨터 환경을 선택하고 다운로드 해주시면 됩니다! - -> 참고로 필자는 ARM 아키텍처를 사용한 애플 실리콘이 탑재된 macOS를 사용하고 있어 위 화면처럼 선택했습니다. - -
    -설치가 완료되었다면 터미널을 열어 아래 명령어를 입력해 Node.js와 npm이 정상적으로 설치되었는지 확인해봅시다. - -~~~zsh -# file: "terminal" -node -v -~~~ - -node 버전 확인 - -
    -~~~zsh -# file: "terminal" -npm -v -~~~ - -npm 버전 확인 - -
    -명령어를 입력했을 때 Node.js와 npm의 버전이 출력된다면 정상적으로 설치가 완료된 것입니다.\ -그럼 이제 NestJS를 설치하러 가봅시다! -
    - -## NestJS 설치하기 \ No newline at end of file