In Web Programming,there’s a lot of words which are used interchangeably:for instance,sockets and websockets.Both are actually the same thing.

A web socket is created for each client browser.So 5 clients connecting at the same time means,the server has opened/created 5 websockets.


These are functions that call themselves immediately after being defined i.e. by adding ( ) after the closing paranthesis of the function definition.Thats all there is -to closures.The only thing that complicates them are the examples people use to explain them-which are often quite lenghty.


In JavaScript we now have a constructor called Promise().

So by calling the constructor using the new keyword,a promise can be created.


Streams can be best defined as the baby of Closures and Promise.To implement the Stream API,its required to get a good grasp of Closures and Promises first.


Just to name a few,we have express-sessions,cookie-parser,body-parser which can be implemented quite well with the express api.

The body-parser is used to parse HTTP bodies,not the headers,just the bodies of a HTTP message.The cookie-parser is for creation,deletion of browser cookies,is good for validation but probably can give rise to a security issue.The express-sessions is for sessions which though are mostly saved on the server side,can also be saved in the browser.Cookies and Sessions together help monitor a user’s activity.

Events API:

The most used and the only constructor function in this NodeJS API is the EventEmitter().

If you take the time to look through other NodeJS core APIs,this is easily the most used dependency for other core APIs.The best example is Streams.


The understanding of this API requires the understanding of the EventEmitter class and Streams API,plus,a grasp of what HTTp actually is-and its architecture,its components,how it works.