Performance: swagger-jsdoc setup
MEDIUM IMPACT
This setup affects initial server startup time and API documentation loading speed.
const swaggerJSDoc = require('swagger-jsdoc'); const options = { definition: { openapi: '3.0.0', info: { title: 'API', version: '1.0.0' } }, apis: ['./routes/*.js'] }; const swaggerSpec = swaggerJSDoc(options);
const swaggerJSDoc = require('swagger-jsdoc'); const options = { definition: { openapi: '3.0.0', info: { title: 'API', version: '1.0.0' } }, apis: ['./**/*.js'] }; const swaggerSpec = swaggerJSDoc(options);
| Pattern | Files Scanned | Startup Delay | CPU Usage | Verdict |
|---|---|---|---|---|
| Scan all JS files recursively | All project JS files | 200-500ms | High | [X] Bad |
| Scan only route files | Limited route folder | 50-100ms | Low | [OK] Good |