thang an bi ngu
This commit is contained in:
28
src/main.ts
28
src/main.ts
@@ -1,10 +1,36 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { cors } from './common/utils/cors.utils';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
// Import DateTime scalar if necessary
|
||||
require('./common/utils/datetime.utils');
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors(cors);
|
||||
await app.listen(3069);
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('EPESS API')
|
||||
.setDescription('API documentation for EPESS application')
|
||||
.setVersion('1.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('api', app, document);
|
||||
|
||||
document.paths['/graphql'] = {
|
||||
get: {
|
||||
summary: 'GraphQL Playground',
|
||||
description: 'Access the GraphQL Playground to interact with the GraphQL API.',
|
||||
responses: {
|
||||
'200': {
|
||||
description: 'GraphQL Playground',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user