| Start |
|---|
| Connecting with SQL via. mssql npm module We will start with creating a simple node application with a basic structure and then connecting with local sql server database and performing some queries on that database. Step 1: Create a directory/folder by the name of project which you intent to create. Initialize a node application using npm init command which will create a package.json in current directory . Step 2: Now we will create a App.js file in this directory and install some packages which we are going to need to connect to sql db. Step 3: Now we will add a basic configuration variable to our application which will be used by mssql module to establish a connection . Step 4: This is the easiest step ,where we start the application and the application will connect to the sql server and print out some simple results . To use promises or async for query execution refer the official documents of the mssql package : RemarksWe have assumed that we will have a local instance of mssql database server running on local machine . You can refer this document (opens new window) to do the same . Also make sure you appropriate user created with privileges added as well. |
Read Article
https://develop.horje.com/learn/1434/reference