0

I've Got a Small Script That Runs Continuously On My Server.

I'd Like To Connect It To a DB To Get Some Data For The Script's Operation. So, I Required The Custom Model I Built, And Node Recognises It - It Does Not Send Back An Error With "Module Not Found".

The DB Script Works, And Pulls Exactly What I Need From The DB. This Is How It Looks (Assume The Connection Is Open - This Is Just The Query & Response Code):

connection.query(sql, function (err,rows){

//Handle Errors
if(err){
    throw err;
}

//If Successful - Log Results For Now (Change To Export Results)
else{
    //console.log(rows);
    rows = exports.rows;
}

});

Unfortunately, Whenever I Call DB.rows In My Main Script, It Returns undefined.

Am I Exporting It Wrong Or The Problem Lies Deeper Within?

Tom Granot
  • 1,840
  • 4
  • 22
  • 52

0 Answers0