19 lines
642 B
TypeScript
19 lines
642 B
TypeScript
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 };
|