From last few months i came across the the coolest thing in programming and because of that i’m gonna teach my childrens that ‘N’ is for NodeJS ;)
Nodejs is the programmig platform developed by some super awesome people who love Javascript by heart over the Googles V8 VM which powers your crome.
I used to use the javascript scence i was 17 years old ,but never expected that node will make it work on servers, i’m really happy it works well :)
Their are many programming languages crowding out on streets like Ruby, Cloujur, Lua, Scala, Go …. any many more but NodeJs is little diffrent, its lightweight easy to build and maintain as its nothing but the javascript, a newbie in a crowd also can program it well, just need to think diffrently.
As Wikipedia says: “Node.js is a packaged compilation of Google’s V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript.” Beyond that, it’s worth noting that Ryan Dahl, the creator of Node.js, was aiming to create real-time websites with push capability, “inspired by applications like Gmail”. In Node.js, he gave developers a tool for working in the non-blocking, event-driven I/O paradigm.
The main idea of Node.js is to use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices…… it means you can use node for whatever you want, the way you like.
Let me show you how to install and run few easy programs based on nodeJS.
- First thing install it, you gonna need nodejs and npm (Node package manager), you will need it to install diffrent node packages , packages are just like a gems in Ruby or Jars in Java.
Walah .. you got all you want (y), not put the below code say in server.js
Run it
But this gonna spawn the single threaded application for you sticking to only one core, we have quad, hexa, octa core processors now day, how node will adjust with it? well, node can do preety anything, Cluster is there for you.
install package with npm
and run below code say in cluster.js
When i did a performacen testing of clustered code, it sucked all juice of my XPS, and fan was running like a Ferrari.
And i said Req/sec : 13266.56 Wow :) Loved NodeJS ♥
A small but awesome tutorial i found on youtube, hope you will love it.
Happy coding .. :)