title: TypeError: sql.Connection is not a function Node.js
body: <p>I am very beginner with node.js and javscript itself. I am trying to establish a basic connection to SQLServer but I am getting the following error:</p>
  
  <blockquote>
    <p>TypeError: sql.Connection is not a function</p>
  </blockquote>
  
  <p>I am following the recommendations of the mssql package git repository</p>
  
  <pre><code>//get an instance of sqlserver 
  var sql = require('mssql');
  
  //set up a sql server credentials
  var config = {
  server: 'localhost',
  database: 'trafiyadb',
  user: 'jhonycage',
  password:  'juan1014',
  port: 1433
  };
  
  
  function con() {
  var dbConn = new sql.Connection(config);
  dbConn.connect().then(function(){
      console.log("connected")
  }).catch(function (err) {
      console.log(err);
  })
  }
  
  con();
  </code></pre>
  
  <p>and this is the package.json</p>
  
  <pre><code>{
   "name": "trafiyaapi",
   "version": "1.0.0",
   "description": "",
   "main": "server.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": {},
   "scripts": {
    "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
   "start": "node server.js"
   },
   "author": "",
   "license": "ISC"
   }
  </code></pre>
  
  <p>I am just executing </p>
  
  <blockquote>
    <p>$node server</p>
  </blockquote>
  
  <p>I must be doing something wrong, how can i connect to database?</p>