Spaces:
Paused
Paused
Complete deployment configuration (part 2)
Browse files- server/src/bootstrap.ts +10 -0
- server/src/index.ts +1 -1
server/src/bootstrap.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import { NestFactory } from '@nestjs/core';
|
| 2 |
import { ExpressAdapter } from '@nestjs/platform-express';
|
|
|
|
| 3 |
import type { INestApplication } from '@nestjs/common';
|
| 4 |
import { AppModule } from './nest/app.module';
|
| 5 |
import { applyGlobalMiddleware } from './middleware/globalMiddleware';
|
|
@@ -40,6 +41,15 @@ export async function buildApp(): Promise<INestApplication> {
|
|
| 40 |
applyPlatformUploads(instance);
|
| 41 |
applyPlatformTransport(instance);
|
| 42 |
applyPlatformStatic(instance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
await app.init();
|
| 44 |
return app;
|
| 45 |
}
|
|
|
|
| 1 |
import { NestFactory } from '@nestjs/core';
|
| 2 |
import { ExpressAdapter } from '@nestjs/platform-express';
|
| 3 |
+
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
| 4 |
import type { INestApplication } from '@nestjs/common';
|
| 5 |
import { AppModule } from './nest/app.module';
|
| 6 |
import { applyGlobalMiddleware } from './middleware/globalMiddleware';
|
|
|
|
| 41 |
applyPlatformUploads(instance);
|
| 42 |
applyPlatformTransport(instance);
|
| 43 |
applyPlatformStatic(instance);
|
| 44 |
+
|
| 45 |
+
const config = new DocumentBuilder()
|
| 46 |
+
.setTitle('TREK API')
|
| 47 |
+
.setDescription('The TREK API documentation')
|
| 48 |
+
.setVersion('1.0')
|
| 49 |
+
.build();
|
| 50 |
+
const document = SwaggerModule.createDocument(app, config);
|
| 51 |
+
SwaggerModule.setup('api-docs', app, document);
|
| 52 |
+
|
| 53 |
await app.init();
|
| 54 |
return app;
|
| 55 |
}
|
server/src/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ const tmpDir = path.join(__dirname, '../data/tmp');
|
|
| 22 |
import * as scheduler from './scheduler';
|
| 23 |
import { getAppUrl, getMcpSafeUrl } from './services/notifications';
|
| 24 |
|
| 25 |
-
const PORT = Number(process.env.PORT) ||
|
| 26 |
const HOST = process.env.HOST;
|
| 27 |
const APP_VERSION: string = process.env.APP_VERSION || (require('../package.json') as { version: string }).version;
|
| 28 |
|
|
|
|
| 22 |
import * as scheduler from './scheduler';
|
| 23 |
import { getAppUrl, getMcpSafeUrl } from './services/notifications';
|
| 24 |
|
| 25 |
+
const PORT = Number(process.env.PORT) || 7860;
|
| 26 |
const HOST = process.env.HOST;
|
| 27 |
const APP_VERSION: string = process.env.APP_VERSION || (require('../package.json') as { version: string }).version;
|
| 28 |
|