- Start a Postgres database server on your machine or in the cloud.
- Set the following environment variables in your .env file
- Use the same enviroment variables for typeorm in your .prod.env file
POSTGRES_HOST=<address-where-database-running>
POSTGRES_PORT=<port-where-database-running>
POSTGRES_DB=<database-name>
POSTGRES_USER=<username-for-database>
POSTGRES_PASSWORD=<password-to-database>
- Install packages and start the application server.
$ npm install
$ npm start
- Build the application
$ npm build
- Generate and apply migrations
$ npm typeorm migration:generate --config .dev.env -n database-migrations
$ npm build
$ npm typeorm migration:run --config .dev.env
Build the docker container and get it up and running.
$ docker-compose build
$ docker-compose up
With docker-compose running, in another terminal:
$ docker exec -it docker_name /bin/sh
$ npm typeorm migration:generate -n migration_name --config .prod.env
$ npm build
$ npm typeorm migration:run --config .prod.env
- Go to http://localhost:8000/swagger to see Swagger documentation for API endpoints.
- Run the APIs by clicking the "Try it now" button on the Swagger page.
Go to http://localhost:8000/admin
$ npm test
$ npm coverage
$ npm lint
$ npm format