feat: complete V1 phases 0-7
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import cookieParser from 'cookie-parser';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { AppConfigService } from './config/app-config.service';
|
||||
|
||||
async function bootstrap(): Promise<void> {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const config = app.get(AppConfigService);
|
||||
|
||||
app.use(cookieParser());
|
||||
app.enableCors({ origin: config.adminWebOrigin, credentials: true });
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
}),
|
||||
);
|
||||
const openApi = new DocumentBuilder()
|
||||
.setTitle('乐活公益暖心服务平台 API')
|
||||
.setVersion('1.0')
|
||||
.addBearerAuth()
|
||||
.addCookieAuth('lehuo_admin_session')
|
||||
.build();
|
||||
SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, openApi));
|
||||
app.enableShutdownHooks();
|
||||
await app.listen(config.apiPort, '0.0.0.0');
|
||||
}
|
||||
|
||||
void bootstrap();
|
||||
Reference in New Issue
Block a user