title: Error: Global connection already exists. Call sql.close() first
body: <p>Hi I am creating node js restful api by using sqlserver database , i prepare get api when i am using that api output is shown in json format, while refreshing that browser gain its shows "Error: Global connection already exists. Call sql.close() first."error . I am adding code </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>var express = require("express");
  
  var sql = require("mssql");
  var app = express();
  
  //Initiallising connection string
  var dbConfig = {
      user: 'sa',
      password: 'India123',
      server: 'localhost',
      database: 'sample'
  
    
  };
  
  app.get('/login', function (req, res) {
  
      // connect to your database
      
      var data = {
  
          "user": ""
      };
      sql.connect(dbConfig, function (err) {
  
          if (err) console.log(err);
  
   
          var request = new sql.Request();
     
        
          request.query('select * from Login', function (err, result) {
  
              if (err) console.log(err)
  
              // send data as a response
              //res.send(result.recordset);
              data["user"] = result.recordset;
              res.send(data);
            
        
          });
      }); 
  
  });
  
  var server = app.listen(5000, function () {
      console.log('Server is running..');
  });</code></pre>
  </div>
  </div>
  
  Please correct me code . thanks advance </p>