I built a simple Node app, and the code works, with no failures, no syntax errors, and does not break, but one component doesn't work right. I showed a snippet on Stack Overflow, in this question, but viewers found no issue. So, I think the infrastructure, the method, in which I put this app together must be problematic, and I'd like to have it reviewed.I put everything into a single source file to eliminate the headache of debugging whilst keeping track of modules. Here is the codeHere's my relevant script:var connection = createConnection();connection.connect(function (err) {    if (err) return callback(new Error('Failed to connect'), null);    console.log('[Post]Connection with the officeball MySQL database opened...');    connection.query(        'INSERT INTO `officeball`.`sales_entries` SET category = ?, `group` = ?, date = ?, price = ?, customer = ?, seller = ?, commission = ?',    salesData),    function (err, rows, fields) {        if (err) console.log(err);        connection.destroy();        console.log('[Post]...Connection with the officeball MySQL database closed.');    }});And here's my console output:Application initializing...Application successfully initialized!Server running at http://127.0.0.1:8080/User username1 is attempting to validate for a hit...Connection with the Officeball MySQL database openned......Connection with the Officeball MySQL database closed.User username1 validated and is ready![Post] Connection with the officeball MySQL database opened...
My node app with valid syntax is failing silently, but not breaking. Infrastructure problem?
javascript;mysql;node.js