-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.js
52 lines (47 loc) · 1.34 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const swaggerAutogen = require('swagger-autogen')();
const doc = {
info: {
title: 'Wallet Engine ',
description: 'The wallet system that transact create wallet, debit wallet and activate and deactive the wallet and many features',
},
host: 'abduljeleelng-wallet-engine.herokuapp.com/api/v1',
basePath: "/",
schemes: ['https'],
consumes: ['application/json'],
produces: ['application/json'],
tags: [
],
securityDefinitions: {
apiKeyAuth: {
type: 'apiKey',
in: 'header', // can be 'header', 'query' or 'cookie'
name: 'Authorization', // name of the header, query parameter or cookie
description: 'any description...'
},
bearerAuth:{
type: 'apiKey',
in: 'header',
name: 'Authorization',
scheme: 'bearer',
bearerFormat: 'JWT'
}
},
securitySchemes:{
bearerAuth:{
type: 'apiKey',
in: 'header',
name: 'Authorization',
scheme: 'bearer',
bearerFormat: 'JWT'
}
},
security:{
bearerAuth:[]
}
};
const outputFile = './docs/swagger-output.json';
const endpointsFiles = ['./src/app/user/routes/index.js'];
/* NOTE: if you use the express Router, you must pass in the
'endpointsFiles' only the root file where the route starts,
such as index.js, app.js, routes.js, ... */
swaggerAutogen(outputFile, endpointsFiles, doc);