This repository will serve as the node api template for new EyeCue projects and Internship Projects
- Design Document
- Built with the Nest framework
This project uses yarn package manager for Node. Please follow the installation instructions on their website.
# install dependencies
$ yarn
# create .env.dev file
cp .env.example .env.dev
# create .env.test file
cp .env.example .env.test
# update POSTGRES_DB to your test-db name
# create the databases
createdb <db-name>
createdb <test-db-name>
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
Negotiation with a postgres instance is managed through TypeORM and the @nestjs/typeorm integration.
Migrations are managed via the Typeorm CLI and the use of scripts in package.json. Most migrations can be generated automatically by changing or adding a *.entity.ts
file and then running the generate script. Migrations should run automatically when starting the application but can also be run or rolled back manually for testing.
# generate a migration
yarn migration:generate -n <my_migration_name>
# create an empty migration
yarn migration:create -n <my_migration_name>
# run migrations
yarn migration:run
# revert migrations
yarn migration:revert
# list migrations and if they have been run
yarn migration:show
# show what sql would run to sync schema in DB with schema generated from *.entity.ts files
yarn schema:log