Skip to content

Commit a1b8b31

Browse files
committed
Add Swagger documentation to API endpoints with swagger-jsdoc and swagger-ui-express packages
1 parent 62908b3 commit a1b8b31

File tree

6 files changed

+441
-2
lines changed

6 files changed

+441
-2
lines changed

app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ const routeManager = require('./route/route.manager.js')
66
const db = require("./models/index");
77
const cors = require('cors')
88
const bodyParser = require('body-parser')
9+
const swaggerDocs = require('./swagger.js')
910

11+
12+
app.use(express.json())
1013
app.use(bodyParser.json())
1114
app.use(bodyParser.urlencoded({extended: false}));
1215
app.use(cors());
@@ -20,6 +23,7 @@ db.sequelize.sync()
2023
});
2124

2225
routeManager(app)
26+
swaggerDocs(app, process.env.PORT)
2327

2428
// error handler
2529
app.use(function (err, req, res, next) {
@@ -42,5 +46,5 @@ app.use(function (req, res, next) {
4246

4347

4448
app.listen(process.env.PORT, () => {
45-
console.log(`Server is running on port ${process.env.PORT}.`);
49+
console.log(`:::::::::::::::: SERVER RUNNING ON ${process.env.PORT}.`);
4650
});

0 commit comments

Comments
 (0)