DAS_2024_1/bondarenko_max_lab_3/books/src/swagger.js

22 lines
488 B
JavaScript
Raw Normal View History

2024-11-25 02:10:37 +04:00
const swaggerJSDoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Books API',
version: '1.0.0',
description: 'API for managing books',
},
},
apis: ['./src/routes/*.js'],
};
const swaggerSpec = swaggerJSDoc(options);
const setupSwagger = (app) => {
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
};
module.exports = setupSwagger;