provapraticabackend/src/config/swagger.ts
AV77web 5184669185
All checks were successful
Deploy to VPS / build (push) Successful in 17s
Deploy to VPS / deploy (push) Successful in 30s
implementato Swagger nel backend
2026-06-09 14:57:40 +02:00

19 lines
642 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 };