/create-nest-server

A starter template for starting nestjs backend server for minimum server configurations

Primary LanguageTypeScript

NestJS Basic Starter

Basic Information of NESTJS MVC code Structure

controllers are basically handles all the incoming routes

services/providers will handle logic behind routes

# Installation

install cli globly

npm i -g @nestjs/cli

create new project in nestjs

nest new .

choose whatever npm,yarn or pnpm (i choose pnpm)

pnpm i

Running the app in

development mode
pnpm run start

watch mode

pnpm run start:dev

production mode

pnpm run start:prod

Test

unit tests

pnpm run test

e2e tests

pnpm run test:e2e

test coverage

pnpm run test:cov

create modules file

add module with name users or any other module

nest g module users

add controllers for users or any other controllers

nest g controller users

add services for users or any other services

nest g service users

dot env configuration

add .env.development or .env.test.local for development and production respectively

    PORT = 7164

add config module in app.module.ts typescript will automatically look up the environment variables from .env file

    pnpm add -D @nestjs/config

Creating nest resouces

nest g resource auth --no-spec