-
Notifications
You must be signed in to change notification settings - Fork 4
/
swagger-config.js
50 lines (47 loc) · 1.28 KB
/
swagger-config.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
const swaggerConfig = {
definition: {
openapi: "3.0.1",
info: {
title: "Node Express Math API with Swagger",
version: "1.0.1",
description:
"This demo contins a Node Express API that performs math operations. The API is tested with Mocha/Chai. New endpoints and tests are generated with Copilot.",
contact: {
name: "Copilot",
url: "https://github.com/features/copilot/",
email: "[email protected]",
},
},
cors: false,
servers: [
{
// Replace with codespace url if need be. Ex. https://bthomas2622-jubilant-chainsaw-x5pxrw4g55q2996x.github.dev/
url: "http://localhost:3000",
},
],
},
apis: ["index.js"],
};
module.exports = swaggerConfig;
// Sample Swagger jsdoc for /add endpoint
// Swagger is located at /api-docs
/**
* @swagger
* /add:
* get:
* summary: Use to request the sum of two numbers
* parameters:
* - name: a
* in: query
* description: The first number to add
* required: true
* type: integer
* - name: b
* in: query
* description: The second number to add
* required: true
* type: integer
* responses:
* '200':
* description: Successful response
*/