Skip to main content

Creating Simple API In Node.js

Creating Simple API In Node.js

In this article, we are going to learn how to create a simple API in node js and use MS SQL as a data source on which we are going to perform CRUD operations.



This article will be written so that both a beginner and a professional can easily understand it.

Before starting with creating API let’s understand basics.

What is Node js?

An Open source, Cross-platform, and runtime environment for executing javascript code outside the browser.
What can we build using it?

We can build Web apps and APIS using node js.
Why node.js if we already have other frameworks?

It is super-fast and highly scalable e.g. PayPal, Uber, Netflix
Build twice as fast with fewer people
33% fewer lines of code
40% fewer files
2x request/sec
35% faster response
The open source library has a large ecosystem.

Javascript is everywhere (front + back).

You can write an entire application using javascript, no need to learn a new language.

Prerequisites
  • Node js is installed [Download node js https://nodejs.org/en/ ]
  • Next, we are going to use Visual Studio Code IDE for Development [ https://code.visualstudio.com/download ]
  • SQL Server Database

Comments

Popular posts from this blog

IList in C#

Lists and arrays implement IList. This interface is an abstraction that allows list types to be used with through a single reference type. Properties of IList Few popular property of IList interface is given below. Count:-  It will return number of object in List IsReadOnly:- This property will indicate whether the IList is read-only or not. Item:- It will return the particular Item of specified index. Example :-  For calling this class method in void Main. Final Output :-  

List in C#

The Collection classes are a group of classes designed specifically for grouping together objects and performing tasks on them. List class is a collection and defined in the System. Collections.Generic namespace and it provides the methods and properties like other Collection classes such as add, insert, remove, search etc. The C# List < T > class represents a strongly typed list of objects that can be accessed by index and it supports storing values of a specific type without casting to or from object. Referred from :- http://csharp.net-informations.com/collection/list.htm Download Code from below link :- https://app.box.com/s/kplszfmpooytythic1b29u85uhiffo9s Example :-  For calling this class method in void Main. Final output :-

ArrayList in C#

Whats is Arraylist? ArrayList is NOT Fixed Length. ArrayList is NOT Strongly Typed. ArrayList can accept string, integer and decimal Simultaneously. Download Code from below link :- https://app.box.com/s/kplszfmpooytythic1b29u85uhiffo9s I am mainly focusing on Example. Example :-  Here i am using ArrayList . For adding and retrieving rows from Array I am using For loop and Foreach loop. TestArrayList :- is class name Method name :- myArraylist() For calling this class method in Void Main.  Final output :-