-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.js
36 lines (33 loc) · 816 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
36
const swaggerJSDoc = require('swagger-jsdoc');
// swagger definition
const swaggerDefinition = {
openapi: "3.0.1",
info: {
title: 'HR API',
version: '1.0.0',
description: 'HR API',
},
host: 'localhost:3000',
basePath: '/v1',
servers: [
{url: "http://localhost:3000"}
],
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT"
}
}
}
};
// options for the swagger docs
const options = {
// import swaggerDefinitions
swaggerDefinition: swaggerDefinition,
// path to the API docs
apis: ['./routes/**/*.yaml'], // pass all in array
};
// initialize swagger-jsdoc
module.exports = swaggerJSDoc(options);