I am integrating swagger doc for a project in node.js and express framework,
NPM: Swagger JSDoc - ^4.0.0 NPM
Below is folder structure: (Note: module-1, module-2 and module-3 are folders!)
- app
- module-1
- module-1.controller.js
- module-1.model.js
- module-1.route.js
- module-2
- module-2.controller.js
- module-2.model.js
- module-2.route.js
- module-3
- module-3.controller.js
- module-3.model.js
- module-3.route.js
Working Example:
swaggerJSDoc({
swaggerDefinition: {
...require('../swagger.json')
},
apis: [
'./app/module-1/*',
'./app/module-2/*'
'./app/module-3/*'
]
})
Node: I don't want to add module path every time when i create a new module like above example.
What i am expecting is below example: I want to set it one time like set main folder/file path and it will load API Doc data automatically from provided main folder/file path.
I tries below example but its not working with /app/*
:
swaggerJSDoc({
swaggerDefinition: {
...require('../swagger.json')
},
apis: [
'./app/*'
]
})
Please guide if is there any way to do this, Any kind of suggestion will be appreciated, Thanks.
That should work
apis: ['./app/**/*.js'],