Moved DB config to ENV (#4)
Co-authored-by: Joe Arndt <jmarndt@users.noreply.github.com> Reviewed-on: #4
This commit is contained in:
parent
6600745072
commit
164e51bf03
10 changed files with 431 additions and 80 deletions
36
README.md
36
README.md
|
|
@ -3,31 +3,29 @@ REST API for expense tracking and budgeting.
|
|||
|
||||
## Project setup
|
||||
```bash
|
||||
$ npm install
|
||||
npm install
|
||||
```
|
||||
|
||||
## Compile and run the project
|
||||
## Run Locally
|
||||
By default, the API looks for a locally running Postgres instance, which can be satisfied by running the following container:
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
docker run --name common-cents-db -e POSTGRES_USER=common-cents -e POSTGRES_PASSWORD=CommonCents_123! -p 5432:5432 -d postgres
|
||||
```
|
||||
|
||||
## Run tests
|
||||
Alternatively, a DB configuration can be provided through an environment file placed in the root directory (`common-cents-api/.env`):
|
||||
```text
|
||||
# .env
|
||||
DB_SYNC=true # should be false for production environment
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_USER=common-cents
|
||||
DB_PASS=CommonCents_123!
|
||||
DB_NAME=common-cents
|
||||
```
|
||||
|
||||
Once the DB is configured/running, the API can be started:
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue