| 1 | // First import: the SDK has to patch http, pg and the rest before Nest pulls them in. |
| 2 | import './instrumentation.js'; |
| 3 | |
| 4 | import { NestFactory } |
| 5 | import { AppModule } |
| 6 | import { SwaggerModule } |
| 7 | import { apiReference } |
| 8 | import { ValidationPipe } |
| 9 | import { DomainErrorFilter } |
| 10 | import { openApiConfig } |
| 11 | import { GIT_TRANSPORT_ROUTES } |
| 12 | import morgan from 'morgan |
| 13 | |
| 14 | async function bootstrap() |
| 15 | const app = |
| 16 | bodyParser: false, |
| 17 | }); |
| 18 | app.enableShutdownHooks(); |
| 19 | app.useGlobalPipes(new |
| 20 | app.use(morgan |
| 21 | app.useGlobalFilters(new |
| 22 | // offset all CRUD apis to /api prefix so it does not conflict with git's rest stuff |
| 23 | app.setGlobalPrefix('/api |
| 24 | |
| 25 | const document = |
| 26 | app.use( |
| 27 | '/reference', |
| 28 | apiReference({ content: |
| 29 | ); |
| 30 | |
| 31 | app.enableCors({ |
| 32 | origin: (process.env |
| 33 | .split(',') |
| 34 | .map((origin) |
| 35 | .filter(Boolean), |
| 36 | credentials: true, |
| 37 | }); |
| 38 | const port = |
| 39 | console.log(`Starting application on |
| 40 | await app.listen |
| 41 | } |
| 42 | await bootstrap(); |