diff --git a/src/app.js b/src/app.js index 746eae0..bfcb69e 100644 --- a/src/app.js +++ b/src/app.js @@ -62,7 +62,7 @@ app.use(cloud_file({ limits: { fileSize: 50000 * 1024 * 1024 }, })); -//Documentacion API +//*** Documentacion API ****// const swaggerUi = require('swagger-ui-express'); const swagger_config = require('./swager_config.js'); app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swagger_config)); diff --git a/src/rutas/rt_Generales.js b/src/rutas/rt_Generales.js index 07365c9..978c458 100644 --- a/src/rutas/rt_Generales.js +++ b/src/rutas/rt_Generales.js @@ -23,18 +23,39 @@ rutas.post('/login_app', controlador_init.login_appTK);//login APP / dev rutas.post('/auth-keygen', controlador_init.auth_keygen);//genera TOKENS / dev rutas.post('/auth-token', controlador_init.auth_token);//Valida TOKENS / dev +/** + * @swagger + * /operaciones: + * post: + * summary: Recibe datos + * description: Endpoint para pruebas de recepción de datos JSON + * responses: + * 200: + * description: Datos recibidos exitosamente + */ rutas.post('/operaciones/', controlador_init.recibe_datos);//testing json reccepcion server /** - * @swagger - * /: - * get: - * description: Returns the App tv - * responses: - * 200: - * description: app de tv y video json - */ + * @swagger + * /app-tv: + * get: + * summary: App TV y video + * description: Muestra la aplicación de TV y video en formato JSON + * responses: + * 200: + * description: Aplicación de TV y video + */ rutas.get('/app-tv/', controlador_init.app_tv);//app de tv y video json +/** + * @swagger + * /tv-online: + * get: + * summary: App TV y video (alternativo) + * description: Muestra la aplicación de TV y video en formato JSON + * responses: + * 200: + * description: Aplicación de TV y video + */ rutas.get('/tv-online/', controlador_init.app_tv);//app de tv y video json rutas.get('/portal/', controlador_init.portal);//app portal cautivo diff --git a/src/swager_config.js b/src/swager_config.js index eac3f81..887c34d 100644 --- a/src/swager_config.js +++ b/src/swager_config.js @@ -1,23 +1,51 @@ -//Generando Documentacion -global.config = require('./config.js'); -var puerto = global.config.server.port; +// Archivo swagger_config.js corregido -// Documentación API -const swaggerJsdoc = require('swagger-jsdoc'); -const options = { +const swaggerJsDoc = require('swagger-jsdoc'); + +// Definir las opciones de Swagger +const swaggerOptions = { definition: { - swagger: '2.0', // Usando Swagger 2.0 + openapi: '3.0.0', info: { title: 'APP-SIGMA-WEB', version: '1.0.0', description: 'Documentación de la API para la aplicación APP-SIGMA-WEB', + contact: { + name: 'pablinux', + email: 'pablinux@hotmail.es' + } }, - host: 'localhost:' + puerto, - basePath: '/', - schemes: ['http'], + servers: [{ + url: 'http://localhost:' + (process.env.PORT || require('./config.js').server.port), + description: 'Servidor de desarrollo' + }], + components: { + securitySchemes: { + bearerAuth: { + type: 'http', + scheme: 'bearer', + bearerFormat: 'JWT' + }, + sessionAuth: { + type: 'apiKey', + in: 'cookie', + name: 'connect.sid' + } + } + } }, - apis: [`${__dirname}/rutas/*.js`], + // Rutas a los archivos que contienen anotaciones de Swagger + apis: [ + './rutas/rt_clientes.js', + './rutas/rt_items.js', + './rutas/rt_Generales.js', + './rutas/rt_cloud.js', + './rutas/rt_apps.js', + './rutas/rt_arduino.js' + ] }; -const swagger_config = swaggerJsdoc(options); -module.exports = { swagger_config }; \ No newline at end of file +// Inicializar Swagger +const swaggerDocs = swaggerJsDoc(swaggerOptions); + +module.exports = swaggerDocs; \ No newline at end of file diff --git a/src/views/app_pedidos.ejs b/src/views/app_pedidos.ejs index 1b7691b..52eef2b 100644 --- a/src/views/app_pedidos.ejs +++ b/src/views/app_pedidos.ejs @@ -1,243 +1,267 @@ -
- - - -