What is Node.js?
Nodejs.org refers to Node as a runtime. Runtime environments dictate how a program is executed. All runtime environments have an event loop, or set of instructions how a programming language handles incoming events and dispatches them.
A ‘non-blocking I/O model’ differentiates Node from other runtime environments. Input and output (I/O) refers to the interaction between the processing system and user or other input making a request. A user clicks their mouse, for example, and the server returns requested data rendered in the browser.
In contrast to a non-blocking model, a blocking I/O is one in which JS code cannot run until the previous operation is complete. In other words, the event loop pauses until the process finishes. Node allows asynchronous, non-blocking events to occur, meaning that a process doesn’t need to finish in order for another to start. This allows an application to handle frequent incoming requests with minimal downtime.
Node is widely used to make server-side applications. The server side of an app takes in requests and responds with data to the front end of the application. This allows requests to create, update, or delete data to be persisted in a database, as well as for information to be accessed from the database and rendered in the front end.
Scalability, low latency, and high bandwith are often noted as key benefits of using Node over other server-side options, due to its non-blocking I/O. More information about how Node works as compared to Ruby’s Event Machine, for example, is available on nodejs.org. There’s also a ‘hello world’ example for creating a server with Node and hosting it on a port.
Finally, node is also open source and has a community of contributors.
- W3Schools – Node.js Intro
- Stack Exchange – Is Node.js a Framework?
- Wikipedia – Runtime System
- Stack Overflow – What is a Run Time Environment?
- Wikipedia – Event Loop
- Wikipedia – Blocking (computing)
- Wikipedia – Asynchronous I/O
- Mozilla – Express/Node Introduction