My Calendar App is a full-stack application designed to help users manage their schedules, expenses, todos, and notes all in one place. The app provides a seamless and intuitive user interface for efficient day-to-day management and includes robust backend support for secure data handling and user authentication.
Describe the bug
The JWT is generated directly within the registerUser and login function using jwt.sign. However, it may be harder to maintain or reuse if you need the token generation logic in other application parts.
To Reproduce
Steps to reproduce the behavior:
Go to 'the backend folder'
Go to 'the controllers folder'
Click on the 'authController'
Scroll down to 'from line 37 - 54 and from line 79 - 94'
See error
Expected behavior
The token generation will by a separate generateToken function. The function will be async and can be awaited, allowing for a cleaner and more reusable approach. The function will be designed to handle the JWT creation and is abstracted away from the core logic.
Benefit: The separation of token generation into its own function (generateToken) makes the code modular and reusable. This function can be easily called in different parts of the application, making maintenance easier.
Describe the bug The JWT is generated directly within the registerUser and login function using jwt.sign. However, it may be harder to maintain or reuse if you need the token generation logic in other application parts.
To Reproduce Steps to reproduce the behavior:
Expected behavior The token generation will by a separate generateToken function. The function will be async and can be awaited, allowing for a cleaner and more reusable approach. The function will be designed to handle the JWT creation and is abstracted away from the core logic.
Benefit: The separation of token generation into its own function (generateToken) makes the code modular and reusable. This function can be easily called in different parts of the application, making maintenance easier.
Screenshots before
**screenshots after fix***
check list
Additional context @divyansh-2005 Assign to me