Skip to content

Latest commit

 

History

History
executable file
·
114 lines (83 loc) · 2.99 KB

README.md

File metadata and controls

executable file
·
114 lines (83 loc) · 2.99 KB

API

Description

Backend API build with Nest Framework.

Built with

Component Using Descrption
Base NestJS
ORM TypeORM
File Upload Multer
Validation Class-Validator
Documentation Open API(Swagger)
Authentication Passport.js
Testing Jest & SuperTest
Code Style Prettier & TS-Lint

Development

Run

Postgres

start Postgres

# start local postgres
docker-compose up postgres
docker-compose up -V postgres #remove volumes

# stop local postgres before restart again
docker-compose down
docker-compose down -v #remove volumes

if error The container name "/postgres" is already in use by container, remove orphan container.

docker ps -a
docker rm 82be5234c94a

Run Dev Mode

# start in watch mode
ng serve api
# to turn on logging for `request`
NODE_DEBUG=request ng serve api
DEBUG=typeorm:* ng serve api
# optinally you can run with prod env(environment.prod.ts) for tesrting! use this for testing only.
ng serve api --prod

Run Prod Mode

# build first
ng build api --prod
# then run
npm run api:start:prod

API URL: http://localhost:3000

Swagger Docs URL: http://localhost:3000/docs

Build

build for production env

npm run api:build

Generate

scaffolding nest artifacts
For more details checkout playbook

# check of nest installed
nest info

# scaffold auth module
nest g module app/auth  --dry-run
nest g controller auth app/auth --flat --dry-run
nest g service auth app/auth --flat --dry-run
nest g class user.entity app/auth --no-spec --dry-run
nest g class auth.exception app/auth --no-spec --dry-run

Test

coverage will be generate in coverage/apps/api

# unit tests
ng test api

# e2e tests
ng test api-e2e

Reference