Swagger
$ npm install –save swagger-ui-express swagger-jsdoc
const swaggerUI = require(‘swagger-ui-express’); var swaggerJSDoc = require(‘swagger-jsdoc’); var swaggerDefinition = { info: { title: ‘Madori4 APIS’, version: ‘1.0.0’, description: ‘Madori4 API’ }, host: ‘myServerIp’, basePath: ‘/’ };
var options = { swaggerDefinition: swaggerDefinition, apis: [’./routes/*.js’] };
var swaggerSpec = swaggerJSDoc(options);
app.use(‘/api-docs’, swaggerUI.serve, swaggerUI.setup(swaggerSpec)); app.js
apis: [’./swagger/swaggerDoc.yaml’]
Swagger editor [https://editor.swagger.io/?_ga=2.85860377.1686533116.1579675523-750807258.1579675523] Swagger generate [https://github.com/diegohaz/rest]