added prefix config
This commit is contained in:
parent
a7ec0e3cde
commit
3f258bcd33
4 changed files with 12 additions and 13 deletions
19
README.md
19
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# common-cents-api
|
||||
# Common Cents API
|
||||
REST API for expense tracking and budgeting.
|
||||
|
||||
## Project setup
|
||||
|
|
@ -14,9 +14,11 @@ Start the API:
|
|||
```bash
|
||||
npm run start:dev
|
||||
```
|
||||
Verify running via the [healthcheck](http://localhost:3000/common-cents/health) endpoint.
|
||||
Verify running via the [healthcheck](http://localhost:3000/common-cents/healthcheck) endpoint.
|
||||
|
||||
Default port (`3000`) can be changed by setting the `PORT=xxxx` environment variable.
|
||||
Default port (`3000`) can be changed by setting the `PORT=` environment variable.
|
||||
|
||||
Default prefix (`common-cents`) can be changed by setting the `PREFIX=` environment variable.
|
||||
|
||||
### Database
|
||||
Supported configurations:
|
||||
|
|
@ -35,14 +37,11 @@ For external Postgres, configure additional environment variables. To simplify t
|
|||
```text
|
||||
# .env
|
||||
|
||||
# API port
|
||||
# API Config
|
||||
PORT=3000
|
||||
|
||||
# Either 'sqlite' or 'postgres' (if not set sqlite will be used)
|
||||
DB_TYPE=sqlite
|
||||
|
||||
# Sync should be false for production
|
||||
DB_SYNC=true
|
||||
PREFIX=common-cents
|
||||
DB_TYPE=sqlite # 'sqlite' or 'postgres'
|
||||
DB_SYNC=true # Sync should be false for production
|
||||
|
||||
# Postgres overrides
|
||||
PG_HOST=localhost
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ meta {
|
|||
}
|
||||
|
||||
get {
|
||||
url: {{localBaseUrl}}/health
|
||||
url: {{localBaseUrl}}/healthcheck
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common';
|
|||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
@Get('health')
|
||||
@Get('healthcheck')
|
||||
health() {
|
||||
return { status: 'healthy' };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { NestExpressApplication } from '@nestjs/platform-express';
|
|||
|
||||
async function bootstrap(): Promise<void> {
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||
app.setGlobalPrefix('common-cents');
|
||||
app.setGlobalPrefix(process.env.PREFIX ?? 'common-cents');
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
}
|
||||
void bootstrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue