title: Node express app calling mssql is saying that Connection is closed
body: <p>I have another app which uses express and routes but this new app i was slimming it down.  I know the connection string stuff is correct </p>
  
  <pre><code>script.getQuestions(connection);
  
  script.getQuestions = function(connection,req, res){
     console.log(connection);
  }
  </code></pre>
  
  <p>I have read that some people said online to change to use a promise for async fixes this... problem is that with my function having <code>req</code> and <code>res</code> i don't know how to pass those in when i even try to refactor with a promise </p>
  
  <p><strong>"ConnectionError: Connection is closed"</strong>    </p>
  
  <p><strong>"(module.js:487:32) code: 'ECONNCLOSED', name: 'ConnectionError' }"</strong></p>
  
  <p>What I call up (script)  is </p>
  
  <pre><code>var sql = require('mssql');
  
  exports.getQuestions = function(connection, req,res){
   console.log(connection);
  var request = new sql.Request(connection);
  
  var query = 'select * from Question'
  request.query(query).then(function(resultset){
      res.json(resultset.recordset);
  }).catch(function(err){
      console.log(err);
      //res.json(err)
  })
  }
  </code></pre>