Skip to content

Commit

Permalink
Documented the user log in
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliviier-dev committed Mar 5, 2024
1 parent 160356b commit b350290
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion src/routes/authRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,55 @@ router.post(
}
);



/**
* @swagger
* /api/auth/login:
* post:
* summary: Login
* description: Log in with email and password to obtain authentication token.
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* format: email
* description: The email address of the user.
* password:
* type: string
* format: password
* description: The password of the user.
* responses:
* 200:
* description: Login successful. Returns a JWT token.
* content:
* application/json:
* schema:
* type: object
* properties:
* token:
* type: string
* description: JWT token for accessing protected endpoints.
* 400:
* description: Bad request. Invalid email or password provided.
* 401:
* description: Unauthorized. Email or password is incorrect.
* 500:
* description: Internal server error. Failed to log in.
*
* security:
* - jwtAuth: [] # Use the defined security scheme "jwtAuth"
*/


router.post(
"/login",
schemaValidator("/signup"),
schemaValidator("/login"),
authController.login_post,
(req: Request, res: Response) => {
return res.send("Logged in successfully");
Expand Down

0 comments on commit b350290

Please sign in to comment.