Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/Swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ const options = {
},
},
},

apis: ['./routes/*.js'], // Auto-discover docs from route files, // Keep this empty now since we defined paths directly above!

apis: [], // Keep this empty now since we defined paths directly above!

};

const swaggerSpec = swaggerJsdoc(options);
Expand Down
1 change: 1 addition & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import dotenv from "dotenv";
import cookieParser from 'cookie-parser';
dotenv.config();
import swaggerUi from 'swagger-ui-express';
import swaggerSpec from './Swagger.js'; // Note: The .js extension is required for ES modules!
Expand Down
23 changes: 23 additions & 0 deletions backend/routes/authRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ import { registration, login, logOut, googleLogin, adminLogin } from '../control

const authRoutes = express.Router();

/**
* @swagger
* /api/auth/registration:
* post:
* summary: Register a new user
* tags: [Auth]
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required: [name, email, password]
* properties:
* name: { type: string, example: "John Doe" }
* email: { type: string, example: "john@example.com" }
* password: { type: string, example: "StrongPass123!" }
* responses:
* 201:
* description: User registered successfully
*/


authRoutes.post("/registration", registration);
authRoutes.post("/login", login);
authRoutes.get("/logout", logOut);
Expand Down