Add nodemon and database connection check

This commit is contained in:
estherdev03
2025-03-19 12:07:10 -06:00
parent 1e17449c45
commit acd37a995b
4 changed files with 390 additions and 3 deletions

View File

@@ -30,4 +30,19 @@ function cleanupExpiredCodes() {
);
}
module.exports = { sendVerificationEmail, cleanupExpiredCodes };
const checkDatabaseConnection = async (db) => {
try {
const connection = await db.getConnection();
//If no error, release the connection
console.log("Connect to database successfully!");
connection.release();
} catch (error) {
console.log("Cannot connect to database: ", error.sqlMessage);
}
};
module.exports = {
sendVerificationEmail,
cleanupExpiredCodes,
checkDatabaseConnection,
};