Nest JS

임성준·2022년 5월 23일
0
post-thumbnail

Nest JS

Nest (NestJS)는 서버측면에서 효율적이고 확장 가능한 Node.js 애플리케이션을 구축 수 있는 프레임 워크이며, TypesScript로 이루어진 mondern JavaScript(*순수 JavaScript도 가능)를 사용한다. 또한 OOP (Object Oriented Programming), FP (Functional Programming) 및 FRP (Functional Reactive Programming) 요소들을 결합시킨다.

Nest는 익스프레스를 사용하지만, 수많은 타사 플러그인 쉽게 사용할 수 있게 해주는 Fastify같은 라이브러리와의 호환 또한 가능하다.

원문
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses modern JavaScript, is built with TypeScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).

Under the hood, Nest makes use of Express, but also, provides compatibility with a wide range of other libraries, like e.g. Fastify, allowing for easy use of the myriad third-party plugins which are available.

Nest JS 설치

명령어 설명
yarn global add @nestjs/cli nestjs cli 설치
nest new project-name nestjs 프로젝트 생성
nest new ./ 기본 구조 생성

Nest JS 구조

src 폴더

  • app.controller.ts
  • app.controller.spec.ts
  • app.module.ts
  • app.service.ts
  • main.ts

파일 설명
app.controller.ts 컨트롤러로 단일 라우터 역할
app.controller.spec.ts 컨트롤러의 단위 테스트
app.module.ts 어플리케이션의 루트 모듈
app.service.ts 서비스로 단일 매서드 역할
main.ts Nest 애플리케이션 인스턴스를 생성하기 위해 핵심 기능 NestFactory를 사용하는
애플리케이션의 메인을 담당

참조

profile
오늘도 공부 📖🌙

0개의 댓글