implementacion de swagger
This commit is contained in:
@@ -5,6 +5,7 @@ const mysql = require('mysql');
|
||||
const cloud_file = require('express-fileupload');
|
||||
const myConecction = require('express-myconnection');
|
||||
const cors_origins = require('cors');
|
||||
|
||||
//inicio de sessiones
|
||||
const session = require('express-session');
|
||||
//const jwt = require('jwt');
|
||||
@@ -14,6 +15,7 @@ global.config = require('./config.js');
|
||||
var puerto = global.config.server.port;
|
||||
|
||||
const app = express();
|
||||
|
||||
//importando rutas
|
||||
const clientesRutas = require('./rutas/rt_clientes');
|
||||
const productosRutas = require('./rutas/rt_items');
|
||||
@@ -30,6 +32,7 @@ app.set('views',path.join(__dirname, 'views'));
|
||||
app.locals = global.config;
|
||||
//app.locals.pretty;//true minificado//false minificado
|
||||
|
||||
|
||||
//***** CONTROL DE CORDS ******/
|
||||
app.use(cors_origins({origin:global.config.origin.any}));
|
||||
//*****inicio de sessiones*****//
|
||||
@@ -59,6 +62,10 @@ app.use(cloud_file({
|
||||
limits: { fileSize: 50000 * 1024 * 1024 },
|
||||
}));
|
||||
|
||||
//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));
|
||||
//rutas
|
||||
app.use('/', clientesRutas);
|
||||
app.use('/', productosRutas);
|
||||
|
||||
@@ -27,6 +27,7 @@ body{
|
||||
}
|
||||
.nom_app{
|
||||
font-family: sigma_tipografia;
|
||||
color: #06dcde;
|
||||
}
|
||||
.login-logo{
|
||||
margin-top: 5px;
|
||||
|
||||
@@ -25,6 +25,15 @@ rutas.post('/auth-token', controlador_init.auth_token);//Valida TOKENS / dev
|
||||
|
||||
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
|
||||
*/
|
||||
rutas.get('/app-tv/', controlador_init.app_tv);//app de tv y video json
|
||||
rutas.get('/tv-online/', controlador_init.app_tv);//app de tv y video json
|
||||
|
||||
|
||||
33
src/swager_config.js
Normal file
33
src/swager_config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
//Generando Documentacion
|
||||
//const swaggerUi = require('swagger-ui-express');
|
||||
//const swaggerDocument = require('./swagger.json');
|
||||
global.config = require('./config.js');
|
||||
var puerto = global.config.server.port;
|
||||
//const swaggerUi = require('swagger-ui-express');
|
||||
//Documentacion API
|
||||
const swaggerJsdoc = require('swagger-jsdoc');
|
||||
const options = {
|
||||
//explore: true,
|
||||
definition: {
|
||||
openapi: '3.1.0',
|
||||
swagger:"2.0",
|
||||
info: {
|
||||
title: 'APP-SIGMA-WEB',
|
||||
version: '1.0.0',
|
||||
},
|
||||
servers:[
|
||||
{
|
||||
url: 'http://localhost:'+puerto,
|
||||
description: 'Development server',
|
||||
},
|
||||
{
|
||||
url: 'http://app.factura-e.net',
|
||||
description: 'Productions server',
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
apis: [`${__dirname, '/rutas/*.js'}`], // files containing annotations as above
|
||||
};
|
||||
const swagger_config = swaggerJsdoc(options);
|
||||
module.exports = { swagger_config };
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="box">
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="https://sigmac.app"><strong><img src="img/sigma_cloud_b64.png" alt="logo" width="52">
|
||||
<a href="https://sigmac.app"><strong><img src="/img/sigma_cloud64.png" alt="logo" width="64">
|
||||
<span class="nom_app">SIGMA</span></strong> Cloud.
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user