Skip to content

Commit

Permalink
Resolving conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielDushime committed May 20, 2024
2 parents 8650968 + 189b825 commit ccb038d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules
.env
/dist
/coverage
/coverage
/dist
4 changes: 4 additions & 0 deletions app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import express, { Request, Response } from "express";
import swaggerUi from 'swagger-ui-express';
import specs from './swagger.config';

const app = express();

Expand All @@ -8,5 +10,7 @@ app.use(express.json());
app.get('/', (_req: Request, res: Response) => {
return res.json({ message: "welcome to ATLP Backend APIs" });
});
// Swagger UI route
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));

export default app;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"pg-hstore": "^2.3.4",
"react-router-dom": "^6.23.1",
"sequelize": "^6.37.3",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.0",
"ts-node": "^10.9.2"
},
"scripts": {
Expand All @@ -33,6 +35,8 @@
"jest": "^29.7.0",
"supertest": "^7.0.0",
"ts-jest": "^29.1.2",
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.6",
"typescript": "^5.4.5"
}
}
17 changes: 17 additions & 0 deletions swagger.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// src/swagger.config.ts
import swaggerJsdoc from 'swagger-jsdoc';

const options: swaggerJsdoc.Options = {
definition: {
openapi: '3.0.0',
info: {
title: 'E-commerce platform API documentation',
version: '1.0.0',
description: 'This is the api documentation of the backend routes of the e-commerce platform',
},
},
apis: ['./src/routes/*.ts']
};

const specs = swaggerJsdoc(options);
export default specs;

0 comments on commit ccb038d

Please sign in to comment.