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