Introducing the Node.js Runtime
What is Node.js?
The following list describes Node.js:
Node.js uses an asynchronous, event-driven programming model
Node.js is single threaded and highly scalable
Node.js is best suited for web applications
Node.js is open-source with a huge community
Node.js is has many available libraries (Node Modules) via NPM library
Synchronous versus Asynchronous Processing
Watch this video to learn about Synchronous versus Asynchronous processing.
Synchronous processing stops the execution until a response is retrieved from a called API. After the response is retrieved, the program continues.
Asynchronous processing calls an API but doesn’t wait for the response. The response is processed later by the calling program using a callback method.
Node.js Event Loop
Node.js uses an asynchronous and non-blocking programming model.
The event loop executes tasks from the event queue and starts the callbacks.
If the queue is empty, the event loop process stops and gives back system resource.
Node modules run in an asynchronous mode by default. If you need synchronous processing, you can use the Node library.