From 13edd682b8b6f75d5d7f568d61e361ecc6a70f16 Mon Sep 17 00:00:00 2001 From: Kilian Decaderincourt Date: Wed, 8 Sep 2021 17:17:39 +0200 Subject: [PATCH] feat: add more configurable options --- README.md | 8 +++++--- src/main.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e8cea33..b354d19 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,10 @@ ## Environement Variables -| Name | Description | Default value | -| --- | --- | --- | -| `STORAGE_URI` | [keyv](https://github.com/lukechilds/keyv) connection string | `""` (in memory) | +| Name | Description | Default value | +| --------------- | ------------------------------------------------------------ | ---------------- | +| `PORT` | Server listening port | 8080 | +| `GLOBAL_PREFIX` | API global prefix for every routes | `/api/v2` | +| `STORAGE_URI` | [keyv](https://github.com/lukechilds/keyv) connection string | `""` (in memory) | Availabe storage adapter: redis, mongo, postgres and mysql diff --git a/src/main.ts b/src/main.ts index b77df16..4cace54 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,8 +5,8 @@ async function bootstrap() { const app = await NestFactory.create(AppModule, { cors: true, }); - app.setGlobalPrefix('api/v2'); + app.setGlobalPrefix(process.env.GLOBAL_PREFIX ?? '/api/v2'); - await app.listen(8080); + await app.listen(process.env.PORT ?? 8080); } bootstrap();