feat: add entity and swagger
This commit is contained in:
1 parent
0416c356b8
commit
346742b157
12 files changed
+652
-66
No files matched your search
+21
@@ -1,8 +1,29 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { SnowflakeUtil } from './core/util/snowflake.util';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
if (['development', 'test'].includes(process.env.NODE_ENV)) {
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle(process.env.APP_TITLE)
|
||||
.setDescription('The api description')
|
||||
.setVersion('1.0')
|
||||
.build();
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('docs', app, document);
|
||||
}
|
||||
SnowflakeUtil.initialize(
|
||||
parseInt(process.env.WORKER_ID, 10),
|
||||
parseInt(process.env.DATACENTER_ID, 10),
|
||||
);
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
||||
Reference in new issue
Block a user