From 3f258bcd33e0fa03c35de450c6ffda003940a82b Mon Sep 17 00:00:00 2001 From: Joe Arndt Date: Tue, 10 Feb 2026 11:35:18 -0600 Subject: [PATCH] added prefix config --- README.md | 19 +++++++++---------- bruno/Common Cents/Health.bru | 2 +- src/app.controller.ts | 2 +- src/main.ts | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d90fe47..f292af3 100644 --- a/README.md +++ b/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 diff --git a/bruno/Common Cents/Health.bru b/bruno/Common Cents/Health.bru index bf48b66..4432b1c 100644 --- a/bruno/Common Cents/Health.bru +++ b/bruno/Common Cents/Health.bru @@ -5,7 +5,7 @@ meta { } get { - url: {{localBaseUrl}}/health + url: {{localBaseUrl}}/healthcheck body: none auth: inherit } diff --git a/src/app.controller.ts b/src/app.controller.ts index e7c14b8..0f03a45 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common'; @Controller() export class AppController { - @Get('health') + @Get('healthcheck') health() { return { status: 'healthy' }; } diff --git a/src/main.ts b/src/main.ts index fdb3b6f..d104832 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,7 @@ import { NestExpressApplication } from '@nestjs/platform-express'; async function bootstrap(): Promise { const app = await NestFactory.create(AppModule); - app.setGlobalPrefix('common-cents'); + app.setGlobalPrefix(process.env.PREFIX ?? 'common-cents'); await app.listen(process.env.PORT ?? 3000); } void bootstrap();