-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswaggerConfig.js
41 lines (38 loc) · 892 Bytes
/
swaggerConfig.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
import swaggerJsdoc from "swagger-jsdoc";
import dotenv from "dotenv";
dotenv.config();
const PORT = process.env.PORT;
const options = {
definition: {
openapi: "3.0.0",
info: {
title: "Ecommerce API",
version: "1.0.0",
description: "API documentation for the Ecommerce system",
},
servers: [
{
url:`http://localhost:${PORT}`,
},
],
components: {
securitySchemes: {
UserBearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
description: "JWT for user role",
},
AdminBearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
description: "JWT for admin role",
},
},
},
},
apis: ["./Routes/*.js"],
};
const swaggerSpec = swaggerJsdoc(options);
export default swaggerSpec;