first commit
This commit is contained in:
commit
9d65fbd235
57 files changed
+15094
No files matched your search
+42
@@ -0,0 +1,42 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import {
|
||||
SwaggerModule,
|
||||
DocumentBuilder,
|
||||
SwaggerCustomOptions,
|
||||
} from '@nestjs/swagger';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const apiVersion = 1;
|
||||
|
||||
if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'test') {
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Moeum API')
|
||||
.setDescription('The Moeum API description')
|
||||
.setVersion('1.0')
|
||||
.addTag('moeum')
|
||||
.addServer(`https://moeum.dahyeon.us/`)
|
||||
.addBearerAuth({
|
||||
type: 'openIdConnect',
|
||||
})
|
||||
.build();
|
||||
const options: SwaggerCustomOptions = {
|
||||
ui: true,
|
||||
raw: ['json'],
|
||||
};
|
||||
const documentFactory = () => SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup(`v${apiVersion}/api`, app, documentFactory, options);
|
||||
}
|
||||
|
||||
app.setGlobalPrefix(`v${apiVersion}`);
|
||||
app.enableCors();
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
await app.listen(process.env.PORT ?? 3415);
|
||||
}
|
||||
bootstrap();
|
||||
Reference in new issue
Block a user