This project uses to simplify and standardize the REST API
Built with
Component
Using
Descrption
Base
ORM
CRUD
File Upload
Validation
Documentation
Authentication
Testing
Code Style
Development
Run
Postgres
start Postgres
# start local postgres
docker-compose up postgres
docker-compose up -V postgres #remove volumes
# start local keycloak
docker-compose up keycloak
# 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.
# start in watch mode
ng serve api
# to turn on logging for `request`
NODE_DEBUG=request ng serve api
DEBUG=typeorm:* ng serve api
# optionally you can run with prod env(environment.prod.ts) for tesrting! use this for testing only.
ng serve api --prod
Run Prod Mode
# clean dist first
npx rimraf dist
# then build
ng build api --prod
# then run
node dist/apps/api/main.js
Build
build for production env
ng build api --prod
# or
yarn workspace @ngx-starter-kit/api build:prod
Commands
# to run custom commands, `check api:typeorm in angular.json`
ng run api:typeorm
Generate
# 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
Unit Test
coverage will be generate in coverage/apps/api
# unit test only changed
ng test api --onlyChanged
# generate coverage
ng test api --codeCoverage
# test in CI env
ng test api --runInBand
E2E Test
ng e2e api
# e2e test with watch mode
ng e2e api --watch
# e2e test in CI env
ng e2e api --forceExit --detectOpenHandles
Health
check API App health
Reference
Awesome Nest
NestJS Samples
TypeORL Samples
&
&
API URL:
Swagger Docs URL:
scaffolding nest artifacts
For more details checkout