What Node.js is
Node.js is an open source, cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux, FreeBSD, NonStop and IBM i.
Advantages
- Web development is done in a dynamic language (JavaScript) on a VM that is incredibly fast (V8). It is much faster than Ruby, Python, or Perl.
- Ability to handle thousands of concurrent connections with minimal overhead on a single process.
- JavaScript is perfect for event loops with first class function objects and closures. People already know how to use it this way having used it in the browser to respond to user-initiated events.
- Many people already know JavaScript, even people who do not claim to be programmers. It is arguably the most popular programming language.
- Using JavaScript on a web server as well as the browser reduces the impedance mismatch between the two programming environments that can communicate data structures via JSON that work the same on both sides of the equation. Duplicate form validation code can be shared between server and client and so on.
Installation
- Install npm (https://nodejs.org/)
- Install Visual Studio 2012
- Install SQL Server 2008 r2
- NTVS 1.0 RC 2 Visual Studio 2012(https://nodejstools.codeplex.com/releases/view/612573)
- Use Angular js library
Procedure
Create a table in your database and insert a row as in the following:
- CREATE TABLE [dbo].[Nodejs](
- [Id] [int] IDENTITY(1,1) NOT NULL,
- [Text] [nvarchar](50) NULL,
- CONSTRAINT [PK_Nodejs] PRIMARY KEY CLUSTERED
- (
- [Id] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY]
- INSERT INTO [IMS1.0].[dbo].[Nodejs]
- ([Text])
- VALUES
- ('Hello word!!')
- GO
How to install all packages
Right-click on npm and select Install New npm Packages.
Open the api.js file and set the Microsoft SQL database credentials and database name.
Enter the following query:


Please download the code and use the following procedure and run the code.

Ghanshyam KumarPosted Apr 3, 2017, 9:55 AM
When first time run . it runs successfully but again refresh the browser then give error
Ghanshyam KumarPosted Apr 3, 2017, 9:54 AM
Getting this error Global connection already exists. Call sql.close() first.
Mohammed IbrahimPosted Apr 5, 2016, 12:23 PM
nice
Debasis SahaPosted Apr 5, 2016, 10:23 AM
Nice One..
Rahul Kumar SaxenaPosted Apr 5, 2016, 3:40 AM
Good Show
Gowtham KPosted Apr 5, 2016, 3:08 AM
Good One
Humayun Kabir MamunPosted Apr 5, 2016, 2:08 AM
Nice...
suraj ghosiPosted Nov 24, 2015, 1:58 AM
prithiv vasudevan put debugger in your js file and also track value using console.log and alert
Vipul MalhotraPosted Aug 31, 2015, 9:28 AM
nice Article.Thanks for sharing
prithiv vasudevanPosted Aug 27, 2015, 8:40 PM
i get an "Error!" message , don't know how to debug , please help .
Divyanshu ChandelPosted Apr 16, 2015, 9:42 AM
Knowledgeable...Thanks for share
Gajendra PawarPosted Apr 15, 2015, 12:56 AM
Good Article for beginners........ :)
Damini JainPosted Apr 15, 2015, 12:53 AM
Thanks
Karthik Muthu KaruppanPosted Apr 14, 2015, 4:34 PM
Good one
Santhakumar MunuswamyPosted Apr 14, 2015, 2:31 PM
Thanks for sharing
Rahul Kumar SaxenaPosted Apr 14, 2015, 2:22 PM
Knowledgeable...