-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.js
35 lines (31 loc) · 813 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
30
31
32
33
34
35
const swaggerAutogen = require('swagger-autogen')({openapi: '3.0.0'});
const doc = {
openapi: '3.0.0',
info: {
version: '3.0.0',
title: 'X2Mint API',
description: 'x2mint-api'
},
host: 'localhost:5005',
components: {
securitySchemes:{
bearerAuth: {
type: 'http',
scheme: 'bearer'
}
}
},
security: [{ Bearer: [] }],
securityDefinitions: {
Bearer: {
type: 'apiKey',
name: 'Authorization',
in: 'header',
},
},
};
const outputFile = './swagger-output.json';
const routes = ['./index.js'];
/* NOTE: If you are using the express Router, you must pass in the 'routes' only the
root file where the route starts, such as index.js, app.js, routes.js, etc ... */
swaggerAutogen(outputFile, routes, doc);