programma-group/starter-mongo

View on GitHub
src/utils/swagger.js

Summary

Maintainability
A
0 mins
Test Coverage
const swaggerJSDoc = require('swagger-jsdoc');

const swaggerDefinition = {
  info: {
    title: 'Express/MongoDB starter app',
    version: '0.0.1',
    description:
      'This is the REST Documentation for Programma group Mongodb starter',
  },
  host: `${process.env.URL}:${process.env.PORT}`,
  securityDefinitions: {
    Bearer: {
      type: 'apiKey',
      name: 'Authorization',
      in: 'header',
    },
  },
  components: {
    responses: {
      UnauthorizedError: {
        description: 'Access token is missing or invalid',
      },
    },
  },
};

const options = {
  swaggerDefinition,
  apis: ['./src/docs/**/*.yaml'],
};

module.exports = swaggerJSDoc(options);