updated readme

This commit is contained in:
Joe Arndt 2026-02-09 23:27:27 -06:00
parent 104b9067c1
commit a7ec0e3cde

View file

@ -10,31 +10,35 @@ npm install
``` ```
## Run Locally ## Run Locally
Start the API on [localhost:3000](http://localhost:3000) Start the API:
```bash ```bash
npm run start:dev npm run start:dev
``` ```
Verify running via the [healthcheck](http://localhost:3000/common-cents/health) endpoint.
Default port (`3000`) can be changed by setting the `PORT=xxxx` environment variable. Default port (`3000`) can be changed by setting the `PORT=xxxx` environment variable.
### Database ### Database
There are two databases that are supported: Supported configurations:
- Postgres (recommended) - SQLite (default)
- SQLite (default for simplicity) - Local Postgres
- External Postgres (recommended)
For simplicity SQLite is used as the database in the `default`/`unconfigured` state. For simplicity, SQLite is used in the `default`/`unconfigured` state.
Using Postgres is pretty simple, by default the API is looking for a locally running instance, which can be satisfied by running the following `docker` container: To use Postgres set the `DB_TYPE=postgres` environment variable. Postgres defaults will look for a local instance, which can be satisfied by running the following `docker` 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
``` ```
To specify Postgres as the database, set the `DB_TYPE=postgres` environment variable. For external Postgres, configure additional environment variables. To simplify this, use an `env` file placed in the root directory (`common-cents-api/.env`):
Alternatively, an external Postgres can be configured through additional environment variables. To simplify all of this, use an `env`file placed in the root directory (`common-cents-api/.env`):
```text ```text
# .env # .env
# Type 'sqlite' or 'postgres' (if not set sqlite will be used) # API port
PORT=3000
# Either 'sqlite' or 'postgres' (if not set sqlite will be used)
DB_TYPE=sqlite DB_TYPE=sqlite
# Sync should be false for production # Sync should be false for production
@ -47,8 +51,6 @@ PG_USER=common-cents
PG_PASS=CommonCents_123! PG_PASS=CommonCents_123!
``` ```
## Bruno ## Bruno
The included `bruno` folder contains a collection of calls to make it more convenient to interact with the API. Local calls assume the default NestJS port (`3000`) is being used. The included `bruno` folder contains a collection of calls to make it more convenient to interact with the API. Local calls assume the default NestJS port (`3000`) is being used.