updated readme
This commit is contained in:
parent
104b9067c1
commit
a7ec0e3cde
1 changed files with 14 additions and 12 deletions
26
README.md
26
README.md
|
|
@ -10,31 +10,35 @@ npm install
|
|||
```
|
||||
|
||||
## Run Locally
|
||||
Start the API on [localhost:3000](http://localhost:3000)
|
||||
Start the API:
|
||||
```bash
|
||||
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.
|
||||
|
||||
### Database
|
||||
There are two databases that are supported:
|
||||
- Postgres (recommended)
|
||||
- SQLite (default for simplicity)
|
||||
Supported configurations:
|
||||
- SQLite (default)
|
||||
- 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
|
||||
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.
|
||||
|
||||
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`):
|
||||
For external Postgres, configure additional environment variables. To simplify this, use an `env` file placed in the root directory (`common-cents-api/.env`):
|
||||
```text
|
||||
# .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
|
||||
|
||||
# Sync should be false for production
|
||||
|
|
@ -47,8 +51,6 @@ PG_USER=common-cents
|
|||
PG_PASS=CommonCents_123!
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue