Node js
Node.js is an open-source as well cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications.
As an asynchronous event driven JavaScript runtime, Node is designed to build scalable network applications.
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. It is an event-driven, non-blocking I/O model which makes lightweight. It is so much efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
Node.js was developed by Ryan Dahl in 2009 and it’s Latest LTS Version: v6.10.0 (includes npm 3.10.10)
Node.js applications are written in JavaScript. We can run them within the Node.js runtime on OS X, Microsoft Windows, and Linux.
It also provides a rich library of various JavaScript modules which simplifies the development of web applications.
You Can Use Node.js >>
- Data Streaming Applications
- I/O bound Applications
- Data Intensive Real-time Applications
- Single Page Applications
- JSON APIs based Applications
You Can Not Use Node.js >>
- For CPU intensive applications.
Some features of Node.js:
- Asynchronous and Event Driven − All APIs of Node.js library are asynchronous or nonblocking. Node.js based server never waits for an API to return data. Server moves to the next API after calling it and a notification mechanism of Events of Node.js. It helps the server to get a response from the previous API call.
- Very Fast − Fast in code execution.
- License − It is released under the MIT license
- Single Threaded but Highly Scalable − Node.js uses a single threaded program. It serves to a much larger number of requests than traditional servers like Apache HTTP Server. Event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers. It creates limited threads to handle requests.
- No Buffering − Never buffer any data. These applications simply output the data in chunks.
#PHP Vs Node.js
PHP:
- Mixing code with content
- Deep code base
- Simplicity
- New code is helping it catch up
- No client app needed
- SQL
- Speed of coding
- Competition
Node.js:
- Separating concerns
- Newer code means more modern features
- Complexity of closures and more
- Dozens of language options
- Service calls are thinner than HTML-fat PHP calls
- JSON
- Raw speed
- Solidarity
Top sites built with Node.Js:
- LinkedIn: They chose Node.js because JavaScript is a programming language that is relatively easy to learn how to code and so it was easier to recruit. They rewrote their front-end in Node.js.
- Google: The search service alone services 100 billion requests a month by 2015, making it the most visited website in the world.
- PayPal/eBay: Simplified their development process. Node.js powers their web applications and has allowed their teams to move much faster in bringing their designs to life.
- Netflix: It significantly improved build times, allowing iterate faster, as they would no longer have to wait 40 minutes for it to compile.
- Uber: For their dispatch system matching drivers and riders.
- GitHub: They use Node.js to serve downloads of repositories.
- Yahoo: A project intended to eliminate the multi-language scenarios that introduce complications for developers.