-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.js
More file actions
33 lines (30 loc) · 788 Bytes
/
swagger.js
File metadata and controls
33 lines (30 loc) · 788 Bytes
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
30
31
32
33
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Tài liệu API',
version: '1.0.0',
description: 'Tài liệu API cho các tuyến đường xác thực',
},
servers: [
{
url: 'http://localhost:3005',
},
],
},
apis: [
'./routes/authRoutes.js',
'./routes/authorRoutes.js',
'./routes/chapterRoutes.js',
'./routes/comicRoutes.js',
'./routes/commentRoutes.js',
'./routes/homeRoutes.js',
'./routes/userRoutes.js'
],
};
const swaggerSpec = swaggerJsdoc(options);
module.exports = (app) => {
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
};