0 points

swagger-jsdoc/GETTING-STARTED.md at master · Surnet/swagger-jsdoc


dashboard

Tue Oct 20 2020 06:51:35 GMT+0000 (UTC)

Posted by @duc.pt172483@gmail.com

const swaggerJSDoc = require('swagger-jsdoc');

const options = {
  definition: {
    openapi: '3.0.0', // Specification (optional, defaults to swagger: '2.0')
    info: {
      title: 'Hello World', // Title (required)
      version: '1.0.0', // Version (required)
    },
  },
  // Path to the API docs
  apis: ['./routes.js'],
};

// Initialize swagger-jsdoc -> returns validated swagger spec in json format
const swaggerSpec = swaggerJSDoc(options);
content_copy Copy

https://github.com/Surnet/swagger-jsdoc/tree/master/docs