Connect Azure SQL Database from Node.js Application

We can easily connect MS Azure SQL Database from our Node.js application. There is a package known as mssql.

So we need to run

$ npm mssql

In Azure, I have a database and table Employee. One important options we need to add while connecting SQL Azure is encrypt: yes. Also we don't need to use port 1433 explicitly while providing connection string information.

Here is the simple code snippet on how to connect

The output would look like,