title: callback is not a function in node js
body: <p>I am trying a simple operation that will result the particular users details from the database. Pooling database and all other connections work perfectly but the callback is not working. Am I doing anything wrong here? </p>
  
  <p>Below is the code I use.</p>
  
  <p>db_crud.js</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  var crud = require('./routes/crud_op_new.js');
  var search = require('./routes/search.js');
  
  var connection;
  var result;
  app.get('/search',(req,res)=&gt;{
    crud.connection(function (con) {
      search.getuser(con,req.param('name'),result);
      res.send(result);
    });
  });
  app.listen(8003);
  </code></pre>
  
  <p>Finally here is where the error occurs ... search.js</p>
  
  <pre><code>exports.getuser = function(connection,req,callback){
  console.log("GET Request iniciated");
  connection.query("select * from user,addr where name=? and user.id=addr.e_id",[req],(err,row)=&gt;{
   if(err){
      callback("DB ERROR: "+err);
   }
   else {
     if(row.length==0){
     callback("No Records found");
    }
     else {
      callback(row);
     }
    }
   });
  }
  </code></pre>
  
  <p>The <code>db_crud</code> will send the credentials to search.js and here the callback is called to send result. crud_op_new.js creates the db pool connection and is in variable con.</p>