DEV Community

Cover image for Node.js workings
Greg David
Greg David

Posted on

Node.js workings

Node.js is a web service provider between the server and the client, say like a middle man or a waiter that delivers the order from the guest to the chef and the food from the chef to the quest.

Node.js gets rid of the blockage system whereby a thread has to wait for a server to provide the required data needed by a client before attending to another client. With Node.js, a client request is been made to the server instead of the thread waiting till the request is being granted, it goes ahead to the next client.

Note: Node.js always keeps track for the client request to ensure that the client get it's request as soon as the request is been granted by the server.

illustration of waiter serving food

A typical example of Node.js working is a restaurant as I mentioned earlier, the waiter waits by the guest table and take his/her order, by taking the order the waiter writes down the order and passes the request (order) to the chef. The chef begins preparing the dish but the waiter won't wait till the chef is done with the meal, the waiter goes ahead to the next guest and repeats going back to the chef to place a second request at the same time checking for the initial order, if the order isn't ready yet, the waiter goes to the next (third) guest and takes the order. The waiter is alerted as soon as the first guest meal is ready and the waiter comes, picks it and delivers to the guest. And continues with taking the orders or delivering the ready meal, with this way if service, everyone is attended to and served on time.

Node.js brings about a whole new possibility in the client and server delivery than the regular request and wait.

Top comments (3)

Collapse
 
santhedeveloper profile image
Sandeep Rout

Great analysis

Collapse
 
gregwitha-g profile image
Greg David

Thanks

Collapse
 
cokerizi profile image
cokerizi

Interesting story telling. I got the picture of node.js