Skip to content

sanogotech/nestjsStarter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

nestjsStarter

nestJS Starter.

NestJs reduces a lot of the time wasted tinkering on directories structure, setting up tests, routes, database connections and so on, everything is solved for the average use case.

The Nest CLI is a command-line interface tool that helps you to initialize, develop, and maintain your Nest applications. It assists in multiple ways, including scaffolding the project, serving it in development mode, and building and bundling the application for production distribution. It embodies best-practice architectural patterns to encourage well-structured apps.

** NestJs RedHat Sponsor

Docs

Install Nodejs and NestJS

* https://nodejs.org/en/download/
$  node -v
$  npm -v
$  npm install typescript --save-dev
$  npx  tsc  file.ts  orr  tsc  file.ts

$ npm install -g @nestjs/cli
$ nest --help
$ nest generate --help

TOP nest commands

  • nest new project
  • nest generate resource or module or controller or service
  • nest add lib
  • nest info

CRUD API in 3 lines using NestJS

  • Create project
  nest  new  myproject
  cd myproject
  npm  run start:dev
  run:  localhost:3000
*CRUD Generator all with
* https://docs.nestjs.com/recipes/crud-generator
nest   generate resource  tutorial

$ npm install --save @nestjs/swagger swagger-ui-express


nest g module tutorial

nest g controller tutorial

nest g service tutorial

Swagger


NestJs StandardMode(tsc) vs MonoMod(webpack)

Install Dependencies

Passport
Passport-local
Jwt
Passport-jwt
SQLIte3
TypeORM
Bcrypt


$ npm install --save @nestjs/passport passport passport-local @nestjs/jwt passport-jwt @nestjs/typeorm typeorm sqlite3 bcrypt

-- dev dependencies --
$ npm install --save-dev @types/passport-local @types/passport-jwt @types/bcrypt   

-- Dotenv (.env) at the root of the project ---

npm install --save @nestjs/config

*.env

SERVER_PORT=3000
MODE=DEV
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=
DB_DATABASE=shopping_list
DB_SYNCHRONIZE=true

Prisma CLI: Database Modeling and Crud Generator

<<<<<<< HEAD
$ npm install prisma --save-dev
=======
npm install prisma --save-dev
npx prisma init

Prisma Client

>>>>>>> d704ab5706029869e7f868bfbc04bc58c93708e8
$ npm install @prisma/client

1. npx prisma init
2. npx prisma migrate dev --name init