-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,42 +6,10 @@ const express = require('express'); | |
const app = express(); | ||
const swaggerUi = require('swagger-ui-express'); | ||
const swaggerJsdoc = require("swagger-jsdoc"); | ||
const swaggerUtils = require("./utils/swagger") | ||
var cors = require('cors'); | ||
|
||
// Swagger set up | ||
const options = { | ||
swaggerDefinition: { | ||
openapi: "3.0.0", | ||
info: { | ||
title: "Time to document that Express API you built", | ||
version: "1.0.0", | ||
description: | ||
"A test project to understand how easy it is to document and Express API", | ||
license: { | ||
name: "MIT", | ||
url: "https://choosealicense.com/licenses/mit/" | ||
}, | ||
contact: { | ||
name: "Swagger", | ||
url: "https://swagger.io", | ||
email: "[email protected]" | ||
} | ||
}, | ||
servers: [ | ||
{ | ||
url: "http://localhost:5000/api" | ||
}, | ||
{ | ||
url: "http://10.9.8.150:5000/api" | ||
}, | ||
{ | ||
url: "https://mg8n2x0r67.execute-api.ap-south-1.amazonaws.com/dev/api" | ||
}, | ||
] | ||
}, | ||
apis: ["./models/employee.js", "./models/leaveType.js", "./models/leave.js", "./routes/employee.js", "./routes/leave.js", "./routes/auth.js"] | ||
}; | ||
const specs = swaggerJsdoc(options); | ||
const specs = swaggerJsdoc(swaggerUtils.options); | ||
|
||
app.use(cors()); | ||
app.use(express.json()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const swaggerOptions = { | ||
swaggerDefinition: { | ||
openapi: "3.0.0", | ||
info: { | ||
title: "Time to document that Express API you built", | ||
version: "1.0.0", | ||
description: | ||
"A test project to understand how easy it is to document and Express API", | ||
license: { | ||
name: "MIT", | ||
url: "https://choosealicense.com/licenses/mit/" | ||
}, | ||
contact: { | ||
name: "Swagger", | ||
url: "https://swagger.io", | ||
email: "[email protected]" | ||
} | ||
}, | ||
servers: [ | ||
{ | ||
url: "http://localhost:5000/api" | ||
}, | ||
{ | ||
url: "http://10.9.8.150:5000/api" | ||
}, | ||
{ | ||
url: "https://mg8n2x0r67.execute-api.ap-south-1.amazonaws.com/dev/api" | ||
}, | ||
] | ||
}, | ||
apis: ["./models/employee.js", "./models/leaveType.js", "./models/leave.js", "./routes/employee.js", "./routes/leave.js", "./routes/auth.js"] | ||
}; | ||
|
||
module.exports.options = swaggerOptions |