forked from prince04-coder/appteam-nimbus-inventory-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.js
29 lines (23 loc) · 776 Bytes
/
swagger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// filepath: /Users/princekhandelwal/Desktop/appteam nimbus/src/swagger.js
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'AppTeam Nimbus API',
version: '1.0.0',
description: 'API documentation for AppTeam Nimbus project',
},
servers: [
{
url: process.env.DEPLOYED_URL || 'http://localhost:3000', // Use the deployed URL or fallback to localhost
},
],
},
apis: ['./routes/*.js', './models/*.js'], // Paths to files containing OpenAPI definitions
};
const specs = swaggerJsdoc(options);
module.exports = (app) => {
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));
};