feat: Enhance backend with request/SQL logging via morgan/winston and fix frontend by correctly rendering email Markdown content using the 'marked' library.
This commit is contained in:
+16
-1
@@ -1,4 +1,5 @@
|
||||
const mysql = require('mysql2');
|
||||
const logger = require('./logger');
|
||||
|
||||
const pool = mysql.createPool({
|
||||
host: process.env.DB_HOST,
|
||||
@@ -10,4 +11,18 @@ const pool = mysql.createPool({
|
||||
queueLimit: 0
|
||||
});
|
||||
|
||||
module.exports = pool.promise();
|
||||
const promisePool = pool.promise();
|
||||
|
||||
const originalExecute = promisePool.execute;
|
||||
promisePool.execute = function(sql, params) {
|
||||
logger.info('Executing SQL', { sql, params });
|
||||
return originalExecute.call(this, sql, params);
|
||||
};
|
||||
|
||||
const originalQuery = promisePool.query;
|
||||
promisePool.query = function(sql, params) {
|
||||
logger.info('Executing SQL', { sql, params });
|
||||
return originalQuery.call(this, sql, params);
|
||||
};
|
||||
|
||||
module.exports = promisePool;
|
||||
|
||||
Reference in New Issue
Block a user