Moved DB config to ENV #4
1 changed files with 15 additions and 4 deletions
19
README.md
19
README.md
|
|
@ -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
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue