/flight-board

API to manage flights for an airport flight board

Primary LanguageTypeScript

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Tasks

  • Decorators for methods don't seem to work (validating body contains required fields)
  • Prometheus / Open Telemetry
  • Swagger - visit /api
  • Airlines
  • Status
  • Flight Schedules
  • Flights
  • Cron process to generate flights for the day
  • Pub/Sub, emit events on changes to flights, update api, redis or aws sns
  • Health Checks
  • Caching

Testing Server Sent Events

nest-cli.json - The assets block under compilerOptions flight.controller.ts - Methods at the bottom of the file. flight.service.ts - Methods at the bottom of the file.

The following endpoints will return HTML that subscribes to SSEs: http://localhost:3000/flight/ssetest http://localhost:3000/flight/ssetest2

The following endpoints will publish to SSEs and update pages above: http://localhost:3000/flight/test http://localhost:3000/flight/test2

add index.html to dist/flight (nestjs doesn't add it to build)

Commands run during development

nest g controller auth nest g service auth nest g module auth

yarn add class-validator class-transformer yarn add @nestjs/jwt passport-jwt yarn add @nestjs/passport passport yarn add bcrypt yarn add -D @types/bcrypt yarn add -D @types/passport-jwt yarn add @nestjs/typeorm typeorm pg yarn add @nestjs/config

npm run typeorm:create-migrations --name=PublicItems yarn typeorm migration:run -d ./typeOrm.config.ts

docker compose up docker exec -it flight-board-postgres-1 psql -U root -W -d nestjs_typeorm

\c \l \dt select * from public.user;

nest g module flight nest g service flight nest g controller flight

yarn add @nestjs/swagger

yarn add @nestjs/schedule yarn add --dev @types/cron

$ yarn add @willsoto/nestjs-prometheus prom-client $ docker buildx build --platform linux/amd64 -t flight-board .

$ helm create flight-board $ cd templates $ kubectl create deployment flight-board --image=[ACCOUNT_ID].dkr.ecr.ap-southeast-2.amazonaws.com/prometheus-sample-app:flight-board --port 3000 --dry-run=client -o yaml > deployment.yaml $ helm install flight-board . # will fail because of missing dependedncies $ helm dependency update

yarn add @nestjs/event-emitter

Installation

$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.