Moved DB config to ENV #4

Merged
joe merged 4 commits from db-config into master 2026-02-09 22:31:15 +00:00
Showing only changes of commit b4743a6ba7 - Show all commits

View file

@ -3,16 +3,27 @@ REST API for expense tracking and budgeting.
## Project setup ## Project setup
```bash ```bash
$ npm install npm install
``` ```
## Compile and run the project ## Run Locally
Run local Postgres DB: By default, the API looks for a locally running Postgres instance, which can be satisfied by running the following container:
```bash ```bash
docker run --name common-cents-db -e POSTGRES_USER=common-cents -e POSTGRES_PASSWORD=CommonCents_123! -p 5432:5432 -d postgres docker run --name common-cents-db -e POSTGRES_USER=common-cents -e POSTGRES_PASSWORD=CommonCents_123! -p 5432:5432 -d postgres
``` ```
Then run the API: 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 ```bash
npm run start:dev npm run start:dev
``` ```