title: sql.Connection is not a constructor
body: <p>I am trying to establish a basic connection to SQL Server, but I am getting the following error:</p>
  
  <blockquote>
    <p>TypeError: sql.Connection is not a constructor</p>
  </blockquote>
  
  <p>My code in server.js</p>
  
  <pre><code>var express = require('express');
  var bodyparser = require('body-parser');
  //1.
  var sql = require('mssql');
  //2.
  var app=express();
  app.use(bodyparser.json());
  app.use(bodyparser.urlencoded({extended:true}));
  var config = {
      server: 'localhost',
      database: 'HouseCost',
      user: 'sa',
      password: '5061369',
      port: 1433
  };
  //app.use("/GetAllSells",function(req,resp,next){
  function loadAction() {
      //4.
      var dbConn = new sql.Connection(config);
      //5.
      dbConn.connect().then(function () {
          //6.
          var request = new sql.Request(dbConn);
          //7.
          request.query("select * from Sells").then(function (recordSet) {
              console.log(recordSet);
              dbConn.close();
          }).catch(function (err) {
              //8.
              console.log(err);
              dbConn.close();
          });
      }).catch(function (err) {
          //9.
          console.log(err);
      });
  }
  //10.
  loadAction();
  
   app.listen(8000);
   console.log("Server Is Run");
  </code></pre>
  
  <p>and my package.json is:</p>
  
  <pre><code>{
   "name": "amin",
   "version": "1.0.0",
   "description": "",
   "main": "ServerSide.js\u001b[A\u001b[B\u001b[B\u001b[B\u001b[A\u001b[B",
   "dependencies": {
    "express": "^4.15.2",
    "body-parser": "^1.17.1",
    "mssql": "^4.0.4",
    "jsonwebtoken": "^7.4.0"
   },
   "devDependencies": {},
  
   "author": "",
   "license": "ISC"
  }
  </code></pre>