📜  nestjs openapi yaml 文件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:03.492000             🧑  作者: Mango

代码示例1
const app = await NestFactory.create(ApplicationModule);
const options = new DocumentBuilder()
    .setTitle("Title")
    .setDescription("description")
    .setVersion("1.0")
    .build();
const document = SwaggerModule.createDocument(app, options);

fs.writeFileSync("./swagger-spec.json", JSON.stringify(document));
SwaggerModule.setup("/api", app, document);

await app.listen(80);