| 1 | import 'dotenv/config'; |
| 2 | import { NestFactory } |
| 3 | import { AppModule } |
| 4 | import morgan from 'morgan |
| 5 | import { apiReference } |
| 6 | import { DocumentBuilder, SwaggerModule |
| 7 | import { toNodeHandler } |
| 8 | import { auth } |
| 9 | |
| 10 | async function bootstrap() |
| 11 | const app = |
| 12 | app.use(morgan |
| 13 | // app.enableVersioning({ type: VersioningType.URI, defaultVersion: '1' }); |
| 14 | const config = |
| 15 | .setTitle('Plane Pal') |
| 16 | .setDescription('Plane Pal API Documentation') |
| 17 | .addBearerAuth( |
| 18 | { |
| 19 | type: 'http', |
| 20 | scheme: 'bearer', |
| 21 | bearerFormat: 'JWT', |
| 22 | name: 'JWT', |
| 23 | description: 'Enter JWT token', |
| 24 | in: 'header', |
| 25 | 'x-tokenName': 'Token', |
| 26 | }, |
| 27 | 'JWT-auth', |
| 28 | ) |
| 29 | .build(); |
| 30 | const document = |
| 31 | SwaggerModule.setup('docs |
| 32 | app.getHttpAdapter().all |
| 33 | app.use( |
| 34 | '/reference', |
| 35 | apiReference({ |
| 36 | spec: { |
| 37 | content: document, |
| 38 | }, |
| 39 | layout: 'modern', |
| 40 | isEditable: false, |
| 41 | metaData: { |
| 42 | title: 'Plane Pal', |
| 43 | description: 'Plane Pal API Documentation', |
| 44 | }, |
| 45 | }), |
| 46 | ); |
| 47 | await app.listen |
| 48 | } |
| 49 | bootstrap(); |