provapraticabackend/src/config/swagger.ts

20 lines
642 B
TypeScript
Raw Normal View History

2026-06-09 14:57:40 +02:00
import { readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import swaggerUi from "swagger-ui-express";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const specPath = path.join(__dirname, "../openapi/openapi.json");
const openApiDocument = JSON.parse(readFileSync(specPath, "utf-8"));
export const swaggerServe = swaggerUi.serve;
export const swaggerSetup = swaggerUi.setup(openApiDocument, {
customSiteTitle: "API Rimborsi Spese Documentazione",
swaggerOptions: {
persistAuthorization: true,
withCredentials: true,
},
});
export { openApiDocument };