Node Ninja — A Treatise on NodeJs
Welcome to Node Ninja — Introduction
NodeJs is really beautiful. And i am not the lone admirer. It is currently powering the backends of some of the finest real time web apps like Uber, NetFlix etc. After spending a year coding in NodeJs, i am still in my honeymoon period.
When it comes to NodeJs, a lot of people mistake it to be a JS framework. Some call it a library.To be concise, actually library code is called by the code we write, e.g we call the Math.min() function in our code, Math is the inbuilt library. On the other hand, express is a framework, because at runtime it calls our code- remember the times when we wrote the code for an api, when the particular api was serviced , express called the user written code. It is essentially Hollywood principle at its best-Don’t call us, we will call you if you are good.
Coming back to the point, NodeJs is neither. It is a JS runtime, built on top of the V8 engine of Chrome. Since JS was an event based language, designed for browsers, it is kind of strange to see it getting so much pitch. A lot of questions start popping in our mind. Is it really overhyped? Will it soon fade away like PHP is fading now? What is it that so many companies in the tech world are going gaga over it? How can the same language be running the front end and the backend code — which are really two disjoint sets?
Through the means of this series, i hope to clear your queries. Maybe i can help arouse your enthusiasm in NodeJs and help you understand what is it best for. And i will be really honoured if i get you to code in Node. Trust me , it is beautiful in its own way. And the community around Node is simply awesome.
So moving forward, i have decided to split this NodeNinja series into a variety of topics. I will start from the fundamentals — synchronous and asynchronous programming, APIs , event loop .. all the way to generators and a little beyond. We will see what sets node apart from the process(not exactly ) spawning web servers , why is it so fast and where it is used.
Then we will move on to the best practices in NodeJs Development. Here we will discuss some testing frameworks, the design principles for APIs in a fast real time web app, what works and what does not. We will see how a decent schema and efficient server code can be ace in the hole for a web app. We will also discuss the advent of MVC frameworks in NodeJs on the lines of Ruby on Rails.
Lastly we will come to scale. How little things in the code can cause your servers to be shaken by the storm of requests that hit us when we are flying really high in the scale clouds. Lastly we will look at node in a pragmatic way. We will also discuss the perennial debate, is it a swiss knife, the final solution for all the ultimate language question with some benchmarks .