- Nestjs란?
Nestjs란... 공식 홈페이지에서는 아래와 같이 나와있다.
Introduction
Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with and fully supports TypeScript (yet still enables developers to code in 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 robust HTTP Server frameworks like Express (the default) and optionally can be configured to use Fastify as well!
Nest provides a level of abstraction above these common Node.js frameworks (Express/Fastify), but also exposes their APIs directly to the developer. This gives developers the freedom to use the myriad of third-party modules which are available for the underlying platform.
구선생님의 힘을 빌려서 발변역을 해보면
Nest (NestJS)은 효율적이고 확장 가능한 Node.js 서버 측 응용 프로그램을 구축하기 위한 프레임워크입니다. Progressive JavaScript를 사용하며 TypeScript를 완벽하게 지원하며 개발자가 순수 JavaScript로 코드를 작성할 수도 있습니다. 또한 객체 지향 프로그래밍(OOP), 함수형 프로그래밍(FP), 및 함수형 반응형 프로그래밍(FRP)의 요소를 결합합니다.
Nest는 Express(기본값)와 같은 견고한 HTTP 서버 프레임워크를 내부적으로 사용하며 선택적으로 Fastify를 구성하여 사용할 수도 있습니다.
Nest는 이러한 일반적인 Node.js 프레임워크(Express/Fastify) 위의 추상화 수준을 제공하지만 개발자에게 직접적으로 이러한 프레임워크들의 API를 노출시킵니다. 이로써 개발자는 기본 플랫폼을 위한 다양한 서드파티 모듈을 자유롭게 사용할 수 있습니다.
즉 백앤드 서버를 JavaScript로.... 프론트앤드를 괴롭힐 수 있다는 것이다!
- Nestjs 설치하기
일단 nestjs 를 사용하기 위해선 nestjs를 설치해야 합니다. nestjs는 node.js 기반으로 돌아가기때문에 당연히 node.js가 설치되어 있어야 합니다.
node가 설치되어있다는 전재로 nestjs를 설치하겠습니다.
터미널에 아래의 명령어를 입력해줍니다.
npm i -g @nestjs/cli
자 이제 nestjs 설치가 끝났습니다! 그래도 혹시 모르니 nest -v 를 입력해서 버전을 확인합니다.
설치가 끝났습니다.
- Nestjs 프로젝트 생성하기
이제 설치를 끝냈으니 프로젝트를 생성해보겠습니다. 아래의 명령어를 통해 프로젝트를 생성합니다.
nest new 프로젝트명
해당 명령어를 입력하면 아래의 이미지와 같이 패키지 매니저를 선택하라고 나옵니다. 전 yarn 을 사용할 예정이니 키보드 화살표를 사용하여 패키지 매니저를 yarn 으로 설정 후 프로젝트를 생성합니다!
기본적인 설치라서 상당히 빠르게 프로젝트가 생성됩니다!!!
프로젝트 실행은 yarn 이므로 yarn start 를 입력하면 nest 프로젝트가 실행됩니다.
'Programming > Nestjs' 카테고리의 다른 글
[Nestjs] .entity.ts 에 사용되는 데코레이터 종류 (1) | 2024.10.09 |
---|