Created on 19th November 2023
•
Implementing user authentication and session management posed a significant challenge. Ensuring secure user login, handling sessions, and protecting against potential vulnerabilities required thorough consideration.
One specific issue we faced was related to session handling using Passport.js. The
passport.deserializeUser
function was not working as expected, leading to difficulties in retrieving user information from the session.To overcome this challenge, we carefully reviewed the Passport.js documentation and identified that the issue was related to the asynchronous nature of the
deserializeUser
function. We adjusted the implementation to useawait
when querying the database for user information, ensuring proper session handling.As the project grew in complexity, maintaining a clean and organized codebase became crucial. Ensuring modularity and a clear structure posed ongoing challenges.
At times,the lack of clear code structure made it challenging to locate and debug specific functionalities. It also affected collaboration among team members.
We addressed this challenge by refactoring the codebase into separate modules and files. Each major functionality (e.g., authentication, user registration, appointments) was organized into dedicated files, enhancing code readability and simplifying maintenance.
Establishing and maintaining relationships between MongoDB models (User, Patient, Doctor) presented challenges, especially when dealing with nested data and references.
We encountered issues with populating nested references, leading to incomplete data retrieval and unexpected behavior.
Overcoming challenge : -To address this, we revisited our MongoDB schema designs and adjusted the way references were defined.