Node.js is a platform built on the Chrome JavaScript runtime.
Node.js is an event-driven I/O server-side JavaScript environment based on Google's V8 engine. The V8 engine executes Javascript very quickly and has very good performance.
Node.js RESTful API syntax
REST (English: Representational State Transfer, referred to as REST) is a software architecture style proposed by Dr. Roy Fielding in his doctoral thesis in 2000.
Representational state transfer is a set of architectural constraints and principles. An application or design that satisfies these constraints and principles is RESTful. It is important to note that REST is a design style and not a standard. REST is typically based on existing widely popular protocols and standards using HTTP, URIs, and XML (a subset of Standard Generalized Markup Language) and HTML (an application of Standard Generalized Markup Language). REST typically uses the JSON data format.
HTTP methods
The following are the four methods of the REST basic architecture:
GET - used to obtain data.
PUT - used to update or add data.
DELETE - used to delete data.
POST - used to add data.
Node.js RESTful API example
{ "user1" : { "name" : "mahesh", "password" : "password1", "profession" : "teacher", "id": 1 }, "user2" : { "name" : "suresh", "password" : "password2", "profession" : "librarian", "id": 2 }, "user3" : { "name" : "ramesh", "password" : "password3", "profession" : "clerk", "id": 3 }}