NestJS

How to create a new NestJS service

Prerequisites

To develop and run a NestJS service you need to install some tools first:

Run these commands to check if both are installed

node -v
npm -v
yarn -v

Install the NestJS CLI

NestJS has its own CLI which is able to generate most boilerplate code. To install the CLI simply run

npm install -g @nestjs/cli

Create a new NestJS service

All services are located in the apps directory. To create a new NestJS prodject go to the apps directory and run

nest new [YOUR_SERVICE_NAME]
yarn install

Run your service

To run your app run yarn start and visit http://localhost:3000 in your browser

To run the tests run yarn test

Read the docs

For more info visit the NestJS docs https://docs.nestjs.com/