Skip to content

Commit

Permalink
feat: Set up Swagger documentation structure
Browse files Browse the repository at this point in the history
-Initialize Swagger JSDoc and Swagger UI integration
-Create basic folder structure for API documentation
-Add swagger.js configuration file
-Set up initial swagger.js file
-Prepare controllers for Swagger annotations
-Add necessary dependencies for Swagger integration
  • Loading branch information
DavidMorenoo committed Dec 5, 2024
1 parent 34bf4f8 commit e101f10
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 2 deletions.
Empty file.
Empty file.
53 changes: 53 additions & 0 deletions LogArtApp/backend/api-docs/swagger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const swaggerJSDoc = require('swagger-jsdoc');
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');

const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'LogArt API',
version: '1.0.0',
description: 'Documentación API REST para la aplicación LogArt',
contact: {
name: 'David Moreno Martín',
email: '[email protected]',
url: 'https://github.com/codeurjc-students/2024-logart',
},
},
servers: [
{
url: 'https://localhost:443/api/v1',
description: 'Servidor de desarrollo',
},
],
components: {
securitySchemes: {
BearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
schemas: {
},
},
security: [
{
BearerAuth: [],
},
],
},
apis: [path.join(__dirname, '../controllers/*.js')],
};

const swaggerSpec = swaggerJSDoc(options);

const swaggerYaml = yaml.dump(swaggerSpec);

fs.writeFileSync(path.join(__dirname, 'api-docs.yaml'), swaggerYaml, 'utf8');

console.log('Archivo api-docs.yaml generado exitosamente.');

module.exports = swaggerSpec;
Loading

0 comments on commit e101f10

Please sign in to comment.