npm add swagger-autogen swagger-ui-express

import swaggerAutogen from "swagger-autogen"
import swaggerUiExpress from "swagger-ui-express"
app.use(
"/docs",
swaggerUiExpress.serve,
swaggerUiExpress.setup({}, {
swaggerOptions: {
url: "/openapi.json",
},
})
);
app.get("/openapi.json", async (req, res, next) => {
// #swagger.ignore = true
const options = {
openapi: "3.0.0",
disableLogs: true,
writeOutputFile: false,
};
const outputFile = "/dev/null"; // 파일 출력은 사용하지 않습니다.
const routes = ["./src/index.js"];
const doc = {
info: {
title: "UMC 7th",
description: "UMC 7th Node.js 테스트 프로젝트입니다.",
},
host: "localhost:3000",
};
const result = await swaggerAutogen(options)(outputFile, routes, doc);
res.json(result ? result.data : null);
});

